# Fix VS Code Workspace Trust Not Enabled Blocking Tasks

You try to run a VS Code task (build, test, deploy), but nothing happens. A notification appears:

bash
Running tasks is disabled in Restricted Mode.

Or the task output shows:

bash
The task cannot be executed because the workspace is not trusted.

VS Code's Workspace Trust feature blocks potentially dangerous operations in untrusted folders.

Understanding Workspace Trust

Workspace Trust determines whether VS Code runs code from the current folder. In Restricted Mode (untrusted workspace):

  • Tasks cannot be executed
  • Debug sessions cannot be started
  • Terminal commands are limited
  • Extension features that run code are disabled
  • Jupyter notebooks cannot execute cells

This protects you from malicious code in downloaded projects.

Trusting the Current Workspace

Click the "Manage" button in the trust notification, or use the Command Palette:

bash
Workspaces: Manage Workspace Trust

Then click "Trust Workspace & Enable All Features". VS Code will remember this decision for the folder.

Configuring Trust Behavior

Control how VS Code handles untrusted workspaces:

json
{
    "security.workspace.trust.enabled": true,
    "security.workspace.trust.startupPrompt": "once",
    "security.workspace.trust.untrustedFiles": "prompt"
}

Options for startupPrompt: - once -- Prompt once per workspace - everytime -- Prompt every time you open the workspace - never -- Never prompt (open in Restricted Mode by default)

Options for untrustedFiles: - prompt -- Ask what to do when opening a file - openInNewWindow -- Open in a new window with restricted mode - promptInNewWindow -- Prompt in a new window

Trusted Folders Configuration

Instead of trusting every workspace, configure specific trusted paths:

json
{
    "security.workspace.trust.untrustedFiles": "prompt",
    "security.workspace.trust.emptyWindow": false
}

You can also configure trusted parent directories. Any workspace under a trusted parent is automatically trusted:

json
{
    "security.workspace.trust.untrustedFiles": "openInNewWindow"
}

Then use the trust management UI to add parent directories:

bash
Workspaces: Manage Workspace Trust > Trusted Folders > Add Folder

Add /home/user/projects/ to trust all projects in that directory.

Task-Specific Trust Issues

Some tasks may fail even in a trusted workspace if the task definition is malformed:

json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "npm run build",
            "group": "build",
            "problemMatcher": [],
            "presentation": {
                "reveal": "always",
                "panel": "new"
            }
        }
    ]
}

If a task's command or args reference untrusted paths, the task may be blocked. Ensure all paths in the task definition are within the trusted workspace.

Diagnosing Trust Issues

Check the current trust state:

bash
Workspaces: Workspace Trust

This shows whether the current workspace is trusted, which features are restricted, and which parent folders are trusted.

Check which extensions are restricted:

bash
Extensions > Filter: @restricted

Extensions in Restricted Mode cannot execute code. They can only provide static features like syntax highlighting and theme.

If you work in an isolated environment and want to disable trust checks entirely:

json
{
    "security.workspace.trust.enabled": false
}

Warning: This disables all workspace trust protections. Opening a malicious project could execute arbitrary code on your machine. Only disable in isolated development environments.

Workspace Trust and Multi-Root Workspaces

In a multi-root workspace, trust is evaluated per-folder:

json
{
    "folders": [
        { "path": "/home/user/trusted-project" },
        { "path": "/home/user/downloads/untrusted-download" }
    ]
}

The first folder may be trusted while the second is not. Task execution is allowed only from trusted folders.