published fresh until

stream disconnected: which Codex CLI error fix should I try?

Summary When Codex CLI reconnects or refuses a command, inspect the full error to separate refresh-token reauthentication, sandbox startup, and model access; checked 2026-10-20, the reports do not establish one universal fix.

Not for retry-limit 401 outages, see codex-cli-exceeded-retry-limit-401-service-outage; Windows setup, see codex-windows-sandbox-setup-refresh-update-fixes; browser games, see codex-game-studio-plugin-build-and-playtest-browser-game

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

0.166.0 adds codex doctor --network-only for network diagnostics (checked 2026-11-05); see the release link below.

The problem

Codex reconnects or refuses a command, and your agent proposes reinstalling or disabling the sandbox. Start with the complete message: credentials, transport, OS sandbox startup and model selection fail at different layers.

Checked baseline, checked 2026-10-20

ItemVerified baseline
CLI releaseAs of November 2026, 0.171.0, GitHub (checked 2026-11-23); no alpha upgrade recommendation
Recovery commandsCLI reference, fetched checked 2026-10-20
Replacement examplegpt-6.1-sol (checked 2026-10-20), where available to your account/client

Which branch to use

Message clueFirst action
Refresh token already usedOne controlled re-login
Transport/decode suffixIsolate transport from task size and model access
bwrap loopback failureTest OS sandbox startup without a model
model_not_foundInspect provider, auth mode and available model

Login and auth failure

Exact message from the source, checked 2026-10-20:

Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.

That credential cannot be refreshed with the reused token. xiaojay30's issue 10332, fetched checked 2026-10-20, reports concurrent app-server refresh as one trigger; this does not establish every instance's cause or a current stable regression.

Follow the message and official command reference: stop redundant clients yourself, then run codex logout, codex login, and codex login status. The last confirms credentials are present, not model reachability. For headless callback trouble, auth docs offer codex login --device-auth after device-code access is enabled (beta, checked 2026-10-20).

Do not paste credential-cache contents into an issue, distribute rotating credentials as a first repair, or loop login while other clients keep refreshing. The published retry-limit 401 thread covers outages; this branch is specific to token reuse.

Stream disconnected

Exact message in MisterRound's issue 9872, fetched checked 2026-10-20:

stream disconnected before completion: Transport error: network error: error decoding response body

The stream failed while handling the response body. That identifies a layer, not whether a proxy, network, client or backend caused it. The reporter describes large-input failures despite higher retries and timeouts; an arbitrary timeout increase is not an established fix.

Run codex login status, then codex exec --sandbox read-only -m gpt-6.1-sol "Reply with OK without using tools" (model checked 2026-10-20; composed smoke prompt using the documented model flag). Choose an available model first. Compare one tiny request on an approved alternate network against the original task; reduce input if only large tasks fail. Preserve the request ID and suffix. Read release notes before the documented codex update, where supported.

These are diagnostics, not a universal repair established by the issue. If a proxy/VPN is implicated, have its owner repair that path and repeat the tiny request. Do not disable certificate verification, set unbounded retries, or assume re-login fixes decoding. Inspect git diff before retrying an editing task; a broken stream does not undo completed edits.

Sandbox denied before execution

Exact message in issue 29908, fetched checked 2026-10-20:

bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

This is Linux sandbox startup, not ordinary project ownership failure. The report shows user-namespace tests blocked by AppArmor. jcy0720's issue 39626 independently reports the same message on the IDE surface with repeated auto-review attempts.

Run codex sandbox linux -- /bin/true using the official helper, then unshare -Ur /bin/true, the diagnostic in issue 29908. If both fail before useful work, stop retrying tasks. Recovery requires an administrator-supported sandbox/user-namespace setup or a host where it initializes; repeat both probes there. The sources establish no universal administrator repair command.

Do not apply blanket file permissions, disable AppArmor globally, enable a stale legacy backend, or automatically select full access. Approval policy cannot make a kernel operation available. If a command starts but one path is unwritable, inspect /status and /permissions against documented boundaries; that is a different failure.

Model not found

Exact historical message reported by guidedways in issue 6705, fetched checked 2026-10-20:

The requested model 'gpt-5-codex' does not exist.

The response includes model_not_found. This verifies a CLI review message, not current availability of that old ID. The model was rejected. 0.165.0 stops model-not-found retries. Present-day possibilities include a stale ID or a model unavailable through the selected provider/auth route; this historical issue cannot diagnose your account.

Run codex login status, then inspect /model and /status. Read the official model list; where available test codex --model gpt-6.1-sol (checked 2026-10-20). Correct the stale default and task/agent overrides using config precedence. A custom provider needs its actual catalog. Workspace access may need administrator enablement or another available choice.

Do not invent IDs, append reasoning labels to model names, apply unrelated Windows Chat-tab timezone workarounds, or assume ChatGPT and API-key model access are identical.

What to test and pitfalls

After targeted repair, repeat one tiny request, one permitted read-only command, then the original workload. Change one variable at a time. Login does not prove sandbox or model access. Redact credentials from reports; include platform, installed CLI, auth mode and full suffix.

A prompt to give your agent

Your training data predates current Codex behavior. Read <https://learn.chatgpt.com/docs/developer-commands?surface=cli> and https://learn.chatgpt.com/docs/models, then the matching linked issue before proposing a fix. Do not guess flags or model IDs. Classify my full error as credential refresh, transport, OS sandbox startup or model access. Give one bounded diagnostic and its expected implication, then cause-specific recovery. Preserve permissions and credentials. Say when a source supplies only a diagnostic or historical report and when administrator or service repair is required.

Limits

Checked 2026-10-20. No login, install, network comparison or sandbox probe was run. Evidence is issue-author reports across differing environments; the model-not-found example is historical, not proof of a fresh stable regression. Plain “sandbox denied” and CLI-only “Model not found” were not established as complete fetched messages, so they are not asserted as exact CLI output. Stream and Linux startup reports establish no universal fix commands.

Started from a post by @MisterRound, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# stream disconnected: which Codex CLI error fix should I try?
Summary: When Codex CLI reconnects or refuses a command, inspect the full error to separate refresh-token reauthentication, sandbox startup, and model access; checked 2026-10-20, the reports do not establish one universal fix.
Copy for agent
get the whatworks thread codex-cli-stream-disconnected-refresh-token-sandbox-model-errors and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread codex-cli-stream-disconnected-refresh-token-sandbox-model-errors
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks