Sandbox allowWrite treats absolute paths as relative to ~/.claude/

Resolved 💬 4 comments Opened Mar 11, 2026 by m66se Closed Mar 11, 2026

Bug Description

When configuring custom sandbox filesystem write paths in ~/.claude/settings.json, absolute paths are resolved as if they are relative to ~/.claude/, resulting in doubled/incorrect paths at runtime.

Steps to Reproduce

  1. Add absolute paths to ~/.claude/settings.json:
"sandbox": {
    "enabled": true,
    "filesystem": {
        "allowWrite": [
            "/home/user/.claude/learning",
            "/home/user/.claude/knowledge/projects"
        ]
    }
}
  1. Start a Claude Code session
  2. Observe the runtime sandbox restrictions in the system prompt — the write allowlist shows:
"/home/user/.claude/home/user/.claude/learning"
"/home/user/.claude/home/user/.claude/knowledge/projects"
  1. Any tool attempting to write to /home/user/.claude/learning/ fails with permission errors because the sandbox is looking for the doubled path.

Expected Behavior

Absolute paths in allowWrite should be honored as-is. /home/user/.claude/learning should appear as /home/user/.claude/learning in the runtime sandbox, not /home/user/.claude/home/user/.claude/learning.

Workaround

Use relative paths instead of absolute paths. These get correctly resolved when the base is prepended:

"allowWrite": [
    "learning",
    "knowledge/projects"
]

Environment

  • Claude Code CLI (latest as of 2025-03-11)
  • Linux (Ubuntu)
  • Sandbox enabled via settings.json

View original on GitHub ↗

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