Introduction

VS Code's Workspace Trust feature protects against malicious code in untrusted workspaces by running in Restricted Mode, which disables tasks, debugging, and many extension features:

bash
Running the contributed command 'workbench.action.tasks.runTask' failed:
Workspace is not trusted. Tasks are disabled in Restricted Mode.

This is a security feature but can be confusing when working on your own projects.

Symptoms

  • Tasks fail with "Workspace is not trusted" error
  • Debug configurations do not start
  • Extensions show as limited or disabled
  • Status bar shows "Restricted Mode" indicator
  • Terminal profile changes are blocked

Common Causes

  • Workspace opened from a location not previously trusted
  • Trust prompt was dismissed without making a decision
  • Workspace trust settings were reset after VS Code update
  • Opening a workspace from a network drive or external device
  • security.workspace.trust.enabled set to true with no trusted folders configured

Step-by-Step Fix

  1. 1.Grant trust to the current workspace:
  2. 2.- Click the "Restricted Mode" indicator in the status bar
  3. 3.- Click "Trust" in the notification
  4. 4.- Or use Command Palette: Workspaces: Manage Workspace Trust
  5. 5.- Click "Trust" for the current folder
  6. 6.Configure trusted folders to prevent future prompts. In user settings:
  7. 7.```json
  8. 8.{
  9. 9."security.workspace.trust.startupPrompt": "never",
  10. 10."security.workspace.trust.enabled": true,
  11. 11."security.workspace.trust.untrustedFiles": "prompt"
  12. 12.}
  13. 13.`
  14. 14.Trust parent directories to cover all sub-projects:
  15. 15.- Command Palette: Workspaces: Manage Workspace Trust
  16. 16.- Go to the "Trusted Folders" tab
  17. 17.- Click "Add Folder" and select your development root directory (e.g., ~/projects/)
  18. 18.- Check "Trust parent folders" to automatically trust subdirectories
  19. 19.Disable Workspace Trust (not recommended for security):
  20. 20.```json
  21. 21.{
  22. 22."security.workspace.trust.enabled": false
  23. 23.}
  24. 24.`
  25. 25.This disables the feature entirely - all workspaces are trusted by default.
  26. 26.Verify trust is active:
  27. 27.- The "Restricted Mode" indicator should disappear from the status bar
  28. 28.- Tasks should run without the trust error
  29. 29.- Debug configurations should start normally

Prevention

  • Trust your development root directory so all projects within it are automatically trusted
  • Keep security.workspace.trust.enabled: true for security when opening unfamiliar code
  • Add commonly used project directories to the trusted folders list
  • Use the "Trust Parent Folders" option to reduce trust prompts for new projects
  • Document Workspace Trust requirements in your team's VS Code setup guide
  • For CI/CD or automated environments, disable Workspace Trust to prevent interactive prompts
  • Review trusted folders periodically and remove entries for projects you no longer work on
  • Be cautious about trusting workspaces downloaded from unverified sources