{"record":{"id":"51af2f4eac435959","repo":"openai/codex","slug":"mcp-http-headers-helper-exited-with-status-status","errorCode":null,"errorMessage":"MCP HTTP headers helper exited with status {status}","messagePattern":"MCP HTTP headers helper exited with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/http_headers.rs","lineNumber":336,"sourceCode":"        job,\n    };\n    let output = tokio::time::timeout(HELPER_TIMEOUT, async {\n        let stdout = process\n            .child\n            .stdout\n            .take()\n            .ok_or_else(|| anyhow!(\"MCP HTTP headers helper stdout was unavailable\"))?;\n        let mut output = Vec::new();\n        stdout\n            .take((MAX_HELPER_OUTPUT_BYTES + 1) as u64)\n            .read_to_end(&mut output)\n            .await?;\n        if output.len() > MAX_HELPER_OUTPUT_BYTES {\n            return Err(anyhow!(\"MCP HTTP headers helper output exceeds 64 KiB\"));\n        }\n        let status = process.child.wait().await?;\n        if !status.success() {\n            return Err(anyhow!(\n                \"MCP HTTP headers helper exited with status {status}\"\n            ));\n        }\n        Ok(output)\n    })\n    .await\n    .map_err(|_| anyhow!(\"MCP HTTP headers helper timed out after 10 seconds\"))??;\n\n    parse_helper_output(output)\n}\n\nfn parse_helper_output(stdout: Vec<u8>) -> Result<HeaderMap> {\n    let stdout = String::from_utf8(stdout)\n        .map_err(|_| anyhow!(\"MCP HTTP headers helper wrote non-UTF-8 data\"))?;\n    let mut deserializer = serde_json::Deserializer::from_str(stdout.trim());\n    let headers = RawHeaderEntries::deserialize(&mut deserializer)\n        .and_then(|headers| {\n            deserializer.end()?;","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/http_headers.rs#L318-L354","documentation":"The headers helper ran to completion but wait() returned a non-zero exit status: whatever credential/provider command was configured refused to produce headers. The status code is included; stderr is discarded (Stdio::null), so the failure reason must be reproduced manually. This is the command failing, not the spawn machinery.","triggerScenarios":"httpHeadersHelper exits non-zero: expired or invalid login in the underlying CLI, unauthenticated tool, DNS/network failure inside the helper, wrong arguments, or missing runtime dependencies.","commonSituations":"Cloud CLI helpers (gcloud, az, aws) with expired logins; pass/1Password lookups failing; corporate proxies blocking the helper's token request; wrong command arguments after a tool upgrade.","solutions":["Run the exact command manually from the configured cwd with a minimal env and inspect the exit status","Re-authenticate the underlying tool (e.g. gcloud auth login) and retry the MCP connection","Fix arguments/flags; verify required dependencies are installed at an absolute path","If the helper needs network, verify the environment allows it (proxy, DNS)"],"exampleFix":"# before: helper exits 1 because gcloud is logged out\n# after: authenticate once, verify, then connect\ngcloud auth application-default login\nsh -c \"$HTTP_HEADERS_HELPER\" >/dev/null && echo ok   # must exit 0","handlingStrategy":"validation","validationCode":"# Verify the helper exits 0 under helper-like conditions\ncd \"$MCP_CWD\" && env -i PATH=/usr/bin:/bin HOME=\"$HOME\" sh -c \"$HTTP_HEADERS_HELPER\" >/dev/null\n[ \"$?\" -eq 0 ] || echo \"helper exits non-zero; run it without >/dev/null to see why\"","typeGuard":"fn is_helper_nonzero_exit(error: &anyhow::Error) -> bool {\n    error.to_string().contains(\"exited with status\")\n}","tryCatchPattern":null,"preventionTips":["Re-authenticate credential CLIs on a schedule before they expire","Test the helper from the configured cwd with a minimal env","stderr is discarded — never rely on it for diagnostics","Alert on non-zero helper exits; they precede MCP connection failures"],"tags":["rust","mcp","headers-helper","exit-status","credentials"],"backgroundTag":"non-zero-exit-code","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}