sandbox.additionalDirectories resolves absolute paths incorrectly (prepends ~/.claude/)

Resolved 💬 3 comments Opened Feb 24, 2026 by dezgit2025 Closed Feb 28, 2026

Bug Description

sandbox.additionalDirectories in ~/.claude/settings.json does not correctly resolve absolute paths. Absolute paths are prefixed with the ~/.claude/ directory, producing invalid paths.

Steps to Reproduce

  1. Add to ~/.claude/settings.json:
"sandbox": {
    "additionalDirectories": ["/Users/username/.agent-memory"]
}
  1. Start Claude Code
  2. Run a Bash command that writes to /Users/username/.agent-memory/ (e.g., SQLite database write)
  3. Command fails with "not writable" / sandbox permission error

Expected Behavior

The absolute path /Users/username/.agent-memory should be added to the sandbox write allowlist as-is.

Actual Behavior

The resolved sandbox config shows the path as /Users/username/.claude/Users/username/.agent-memory — the absolute path is joined relative to ~/.claude/ instead of being used directly. Relative paths (e.g., ../.agent-memory) also don't resolve correctly.

Environment

Workaround

Using "Allow unsandboxed fallback" mode — when the sandboxed write fails, Claude retries with dangerouslyDisableSandbox: true which goes through normal permissions.

View original on GitHub ↗

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