Answer: For a host-not-allowed error, approve the host when prompted or add it to `allowedDomains` (if `allowManagedDomainsOnly` locks the allowlist, ask your administrator). For commands failing to reach a server on localhost, on macOS set `network.allowLocalBinding` to `true`; on Linux and WSL2 run the command outside the sandbox with `excludedCommands`, since `allowLocalBinding` has no effect there. Status: Confirmed Entry: tool/claude-code/troubleshooting/sandbox-troubleshooting Revision: 2 Digest: sha256:d6c1d7ebaadae915 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:05:34Z Last changed: 2026-11-15T12:24:54Z (macOS localhost fix: — → network.allowLocalBinding) Last verified: 2026-11-20T12:24:39Z Next check: 2026-11-21T12:24:39Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of host-not-allowed fix | allowedDomains | [1] | 2026-11-20 macOS localhost fix | network.allowLocalBinding | [1] | 2026-11-20 Linux/WSL2 localhost fix | excludedCommands | [1] | 2026-11-20 Linux/WSL2 allowLocalBinding effect | allowLocalBinding | [1] | 2026-11-20 managed allowlist key | allowManagedDomainsOnly | [1] | 2026-11-20 Sources: [1] Anthropic. "Configure the sandboxed Bash tool". https://code.claude.com/docs/en/sandboxing.md Role: primary. Accessed: 2026-11-20T12:24:39Z Quote: "Approve the host when prompted, or add it to [`allowedDomains`]" (Supports: host-not-allowed fix) Quote: "**macOS**: set [`network.allowLocalBinding`](https://code.claude.com/docs/en/settings-reference#sandbox-network-allowlocalbinding) to `true`." (Supports: macOS localhost fix) Quote: "Run the command that needs the host's server outside the sandbox with [`excludedCommands`]" (Supports: Linux/WSL2 localhost fix) Quote: "A direct connection to `localhost` or `127.0.0.1` doesn't reach servers on the host, and `allowLocalBinding` has no effect." (Supports: Linux/WSL2 allowLocalBinding effect) Quote: "If your organization locks the allowlist with `allowManagedDomainsOnly`, there's no prompt, so ask your administrator to add the host." (Supports: managed allowlist key) Published: 2026-11-20T02:54:51Z Snapshot SHA-256: 23b9ba15ebad247fa2322225307e688eb23e118406296a6d6d6beee51fed6798 (captured 2026-11-20T12:24:35Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:24:39Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:24:39Z Last attempt: 2026-11-20T12:24:39Z Notes and limitations: Extracted automatically from a single official source (section "Troubleshooting"). Related: https://latestn.com/tool/claude-code/troubleshooting/scheduled-tasks-limitations What are the limitations of session-scoped scheduled tasks in Claude Code? https://latestn.com/tool/claude-code/troubleshooting/screen-reader-limitations What are the known limitations of using Claude Code with a screen reader? https://latestn.com/tool/claude-code/troubleshooting/simulator-pane-not-opening Why doesn't the iOS Simulator pane open when Claude runs my app in Claude Code? https://latestn.com/tool/claude-code/troubleshooting/retrigger-failed-review How do I retrigger a failed or timed-out Claude Code review? https://latestn.com/tool/claude-code/troubleshooting/run-diagnostic-checks How do I run diagnostic checks to troubleshoot Claude Code installation? https://latestn.com/tool/claude-code/troubleshooting/run-test-loop How do I run the test loop to verify a self-hosted runner image in Claude Code? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-15T12:24:54Z | changed | macOS localhost fix: — → network.allowLocalBinding | [1] 2026-11-15T12:24:54Z | changed | macOS localhost setting: network.allowLocalBinding → — | [1] 2026-11-13T03:05:34Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/troubleshooting/sandbox-troubleshooting/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/troubleshooting/sandbox-troubleshooting POST: https://latestn.com/dispute/tool/claude-code/troubleshooting/sandbox-troubleshooting with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/troubleshooting/sandbox-troubleshooting?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I fix Claude Code sandbox errors like host-not-allowed or commands failing to reach localhost? Revision 2, last verified 2026-11-20T12:24:39Z. https://latestn.com/tool/claude-code/troubleshooting/sandbox-troubleshooting (accessed 2026-11-21T09:56:57Z). @misc{LatestN_tool_claude_code_troubleshooting_sandbox_troubleshooting_r2, title = {How do I fix Claude Code sandbox errors like host-not-allowed or commands failing to reach localhost?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/troubleshooting/sandbox-troubleshooting}}, note = {Revision 2; digest sha256:d6c1d7ebaadae915; last verified 2026-11-20T12:24:39Z; accessed 2026-11-21T09:56:57Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/troubleshooting/sandbox-troubleshooting