[BUG] excludedCommands in sandbox settings doesn't bypass sandbox

Resolved 💬 3 comments Opened Jan 13, 2026 by pierrevalade Closed Feb 27, 2026

Preflight Checklist

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

What's Wrong?

Bug: excludedCommands in sandbox settings doesn't bypass sandbox

Description

Commands listed in sandbox.excludedCommands in .claude/settings.local.json are still executed with sandbox restrictions enabled, causing them to fail.

Steps to Reproduce

Expected Behavior

Commands listed in sandbox.excludedCommands should automatically run without sandbox restrictions, without requiring the user to manually approve sandbox bypass.

Actual Behavior

The command runs sandboxed, causing it to fail. In this case, codex crashed with a Rust panic because the sandbox blocked access to macOS system configuration APIs:

thread 'main' panicked at system-configuration-0.6.1/src/dynamic_store.rs:154:1:
Attempted to create a NULL object.

When explicitly running with dangerouslyDisableSandbox: true, the command works correctly.

Environment

  • Claude Code version: (latest as of 2025-01-12)
  • OS: macOS (Darwin 25.0.0)
  • Command affected: codex (OpenAI Codex CLI v0.80.0)

Additional Context

The excludedCommands setting appears to be parsed correctly (it's in the settings file), but Claude's tool execution doesn't check this list before deciding whether to sandbox a command. The sandbox bypass only happens when Claude explicitly sets dangerouslyDisableSandbox: true in the Bash tool call, which it doesn't do automatically for excluded commands.

What Should Happen?

Expected Behavior

Commands listed in sandbox.excludedCommands should automatically run without sandbox restrictions, without requiring the user to manually approve sandbox bypass.

Error Messages/Logs

Steps to Reproduce

  1. Add a command to excludedCommands in .claude/settings.local.json:
{
  "sandbox": {
    "enabled": true,
    "excludedCommands": [
      "codex"
    ]
  }
}
  1. Ask Claude to run the command (e.g., "run codex with a test prompt")
  1. Claude runs the command with sandbox enabled (default behavior), ignoring the excludedCommands setting

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.2

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗