Codex can’t reach the network in the sandbox. Turn network_access on
When Codex CLI or the IDE extension fails npm install, curl, or other network calls inside the sandbox, the default `workspace-write` mode has network off. Enable `[sandbox_workspace_write] network_access = true` (and approve when asked)—don’t jump straight to full unrestricted access. Short answer: 5 steps. 1) Confirm you are in workspace-write with network off; 2) Enable network for workspace-write in config.toml; 3) Or toggle it for one CLI session; 4) Approve network when the policy still asks; 5) Avoid danger-full-access for routine installs.
Last updated: · This page is the decision checklist; the tools list for “Open network access in the Codex sandbox” is a separate URL.
How do I fix this: Codex can’t reach the network in the sandbox?
Confirm you are in workspace-write with network off
On Codex CLI, the ChatGPT desktop app, and the IDE extension, the default sandbox keeps network access turned off in `workspace-write`. Codex can still edit and run local commands in the workspace; outbound network needs an explicit grant or an approval when the agent asks. Official guide: https://developers.openai.com/codex/agent-approvals-security
Enable network for workspace-write in config.toml
In `~/.codex/config.toml` or the project Codex config, set: ``` [sandbox_workspace_write] network_access = true ``` Keep `sandbox_mode = "workspace-write"` unless you intentionally want a different mode. This turns network on for sandboxed commands without removing the filesystem boundary.
Or toggle it for one CLI session
For a one-off run: `codex -c 'sandbox_workspace_write.network_access=true'`. If you also want destination filtering after network is enabled, OpenAI documents the `network_proxy` feature with an allow/deny domain map—the proxy does not grant network by itself; `network_access` must already be true.
Approve network when the policy still asks
With the Auto preset (`--sandbox workspace-write --ask-for-approval on-request`), Codex asks before commands that need network even after you understand the sandbox. Approve that prompt for trusted installs, or use `/permissions` when you only want a read-only planning session. Do not confuse a denied network call with a login failure.
Avoid danger-full-access for routine installs
`sandbox_mode = "danger-full-access"` removes the sandbox filesystem and network boundaries. OpenAI documents it for cases where you deliberately want unrestricted execution. Prefer enabling `network_access` under `workspace-write`, then add `network_proxy` domain rules if you need a tighter allowlist. https://developers.openai.com/codex/agent-approvals-security
Which tools are best to open network access in the Codex sandbox?
Agent approvals & security
Sandbox vs approval policy, workspace-write network_access, and network_proxy.
Sandboxing overview
How local sandbox modes bound filesystem and network for CLI, IDE, and desktop.
Codex CLI
Local agent entry point; use config.toml or -c flags for network_access.
Advanced Configuration
sandbox_mode and [sandbox_workspace_write] network_access keys in config.toml.
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 network access in the Codex sandbox” →
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.