Claude Code’s Bash sandbox blocked npm or curl. Allow the host, don’t turn the sandbox off
With the Bash sandbox on, shell commands have no direct network route—hosts must pass `network.allowedDomains` (or you approve a one-off / unsandboxed retry). A failed `npm install` or `curl` is usually a missing domain allowlist, not a broken install. Short answer: 5 steps. 1) Confirm the failure is the sandbox, not the tool; 2) Allow the domains the command needs; 3) Grant filesystem writes tools need outside the project; 4) Use an unsandboxed retry only for one trusted command; 5) Re-test with a probe, then your real command.
Last updated: · This page is the decision checklist; the tools list for “Open Claude Code sandbox network access” is a separate URL.
How do I fix this: Claude Code’s Bash sandbox blocked npm or curl?
Confirm the failure is the sandbox, not the tool
If Bash sandboxing is enabled (`/sandbox` or `sandbox.enabled: true`), sandboxed shell commands send traffic through a local proxy that checks hosts against your allowlist—which starts empty. Symptoms include `Could not resolve host` on a curl that bypasses the proxy, or package installs that can’t reach the registry. The sandbox covers Bash/PowerShell/Monitor only; Read, Edit, Write, WebFetch, and MCP are outside it. Docs: https://code.claude.com/docs/en/sandboxing
Allow the domains the command needs
Add the registries and APIs you actually use under `sandbox.network.allowedDomains` in settings (for example your npm registry host, GitHub, or company package mirrors). Prefer allowing specific hosts over disabling the sandbox. Denied domains stay blocked even if you later broaden other rules. Configure via `/sandbox` or `settings.json` as described in the sandboxing guide.
Grant filesystem writes tools need outside the project
By default sandboxed commands may write the working directory, a per-user temp dir, and paths you added with `--add-dir` / `additionalDirectories`. Tools like `npm`, `kubectl`, or `terraform` that write under `~/.npm`, `~/.kube`, and similar need `sandbox.filesystem.allowWrite` for those paths—keep the command sandboxed instead of excluding it.
Use an unsandboxed retry only for one trusted command
When a sandboxed command fails, Claude may ask to retry with `dangerouslyDisableSandbox`. Approve only if you trust that exact command with full access. To stop retries entirely, set `allowUnsandboxedCommands: false` (Strict sandbox mode on the `/sandbox` Overrides tab). For a recurring tool that cannot work inside the sandbox, add a narrow `sandbox.excludedCommands` pattern (for example `docker compose *`) rather than turning the whole sandbox off.
Re-test with a probe, then your real command
Ask Claude to run a sandboxed probe such as reaching an allowed host, then retry `npm install` or your build. If Linux/WSL2 sandbox deps are missing (`bubblewrap`, `socat`), `/sandbox` shows a Dependencies tab—install them and restart. Native Windows runs unsandboxed unless you use WSL2. Keep secrets out of broad `excludedCommands` patterns.
Which tools are best to open Claude Code sandbox network access?
Configure the sandboxed Bash tool
Official sandbox defaults: empty network allowlist via proxy, filesystem allowWrite, excludedCommands, and unsandboxed retries.
Settings
Where sandbox.enabled, network, and filesystem keys live in user, project, and local settings files.
Permission modes
How auto vs Manual mode interacts with sandboxed commands and unsandboxed retry prompts.
Claude Code overview
Product entry point for the CLI/IDE agent that runs sandboxed Bash.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Open Claude Code sandbox network access” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.