Skip to content

[BUG] The setting excludedCommands doesn't seem to be respected. #10524

@klillywhite

Description

@klillywhite

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary

The sandbox.excludedCommands setting in .claude/settings.json is being ignored. Commands listed in this array are still being executed with sandboxing enabled, contrary to the documented behavior.

Expected Behavior

According to the settings documentation, excludedCommands should specify "Commands that should run outside of the sandbox." When a command is listed in this array, Claude Code should execute it outside the sandbox from the first attempt.

Actual Behavior

Commands listed in excludedCommands are still executed in the sandbox. Claude Code only attempts to run them outside the sandbox after the sandboxed execution fails and encounters errors indicating sandbox restrictions.

Steps to Reproduce

  1. Create .claude/settings.json with the following configuration:
{
  "sandbox": {
    "enabled": true,
    "excludedCommands": ["uv"]
  }
}
  1. Run a command that would trigger the excluded command:
> run uv sync
  1. Observe that Claude Code first attempts to run uv sync inside the sandbox, which fails with:
error: failed to open file `~/.cache/uv/sdists-v9/.git`: Read-only file system (os error 30)
  1. Claude Code then attempts to retry outside the sandbox

Configuration Used

Note: The settings file was copied directly from the official settings documentation to avoid any syntax errors or misspellings. The only modification made was replacing "docker" with "uv" in the excludedCommands array to demonstrate this issue.

{
  "sandbox": {
    "enabled": true,
    "autoAllowBashIfSandboxed": true,
    "excludedCommands": ["uv"],
    "network": {
      "allowUnixSockets": [
        "/var/run/docker.sock"
      ],
      "allowLocalBinding": true
    }
  },
  "permissions": {
    "deny": [
      "Read(.envrc)",
      "Read(~/.aws/**)"
    ]
  }
}

Environment

  • Claude Code version: v2.0.28
  • Model: Sonnet 4.5 (Claude Max)
  • Platform: Linux 6.12.48-1-MANJARO

Impact

This bug defeats the purpose of the excludedCommands setting. Tools like uv, docker, and watchman that are incompatible with sandboxing (as noted in the sandboxing documentation) will always fail on the first attempt, requiring:

  • Extra retries and API calls
  • User intervention to approve the unsandboxed execution
  • Unnecessary error messages and friction in the workflow

What Should Happen?

According to the settings documentation, excludedCommands should specify "Commands that should run outside of the sandbox." When a command is listed in this array, Claude Code should execute it outside the sandbox from the first attempt.

Error Messages/Logs

Steps to Reproduce

  1. Create .claude/settings.json with the following configuration:
{
  "sandbox": {
    "enabled": true,
    "excludedCommands": ["uv"]
  }
}
  1. Run a command that would trigger the excluded command:
> run uv sync
  1. Observe that Claude Code first attempts to run uv sync inside the sandbox, which fails with:
error: failed to open file `~/.cache/uv/sdists-v9/.git`: Read-only file system (os error 30)
  1. Claude Code then attempts to retry outside the sandbox

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.28

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions