{"record":{"id":"f3e23d4032b23bd6","repo":"openai/codex","slug":"non-local-http-mcp-server-server-name-did-not","errorCode":null,"errorMessage":"non-local HTTP MCP server `{server_name}` did not resolve an execution environment","messagePattern":"non-local HTTP MCP server `(.+?)` did not resolve an execution environment","errorType":"exception","errorClass":"StartupOutcomeError","httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/rmcp_client.rs","lineNumber":1152,"sourceCode":"            .await\n            .map_err(|err| StartupOutcomeError::from(anyhow!(err)))\n        }\n        McpServerTransportConfig::StreamableHttp {\n            url,\n            http_headers,\n            env_http_headers,\n            bearer_token_env_var,\n            http_headers_helper: _,\n        } => {\n            let http_client = runtime_context\n                .http_client_for_server(server.config(), resolved_environment.as_ref())\n                .map_err(|error| StartupOutcomeError::from(anyhow!(error)))?;\n            let http_client = maybe_with_openai_docs_source_attribution(&url, http_client);\n            let executor_resolves_bearer_token = if !is_local_environment\n                && bearer_token_env_var.is_some()\n            {\n                let Some(environment) = resolved_environment.as_ref() else {\n                    return Err(StartupOutcomeError::from(anyhow!(\n                        \"non-local HTTP MCP server `{server_name}` did not resolve an execution environment\"\n                    )));\n                };\n                environment\n                    .info()\n                    .await\n                    .map_err(|error| StartupOutcomeError::from(anyhow!(error)))?\n                    .capabilities\n                    .http_header_env_vars\n            } else {\n                false\n            };\n            let (http_client, resolved_bearer_token) = if executor_resolves_bearer_token\n                && let Some(env_var) = bearer_token_env_var.as_ref()\n            {\n                (\n                    Arc::new(ExecutorEnvironmentHttpClient {\n                        bearer_token_env_var: env_var.clone(),","sourceCodeStart":1134,"sourceCodeEnd":1170,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/rmcp_client.rs#L1134-L1170","documentation":"For a non-local streamable-http server with bearer_token_env_var, Codex must ask the resolved execution environment whether the executor resolves that token (its http_header_env_vars capability). resolved_environment came back Ok(None) - no environment attached - so the decision cannot be made and the server refuses to start rather than silently reading the token from the wrong (local) environment.","triggerScenarios":"Config marks an HTTP MCP server as non-local and sets bearer_token_env_var, but environment resolution produced None: the referenced execution environment is missing or unregistered, was removed between config publish and server start, or app-server and exec-server versions disagree on environment resolution.","commonSituations":"Cloud executor misconfiguration with a dangling environment reference; exec-server older than the app-server; race where a config referencing an environment is applied before the environment is registered.","solutions":["Fix or restore the execution-environment reference so resolution returns an environment (register/repair it in the exec-server the runtime talks to)","Align app-server and exec-server versions so environment resolution agrees","If the server actually runs locally, remove the non-local environment setting so the token resolves from the host env"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only start non-local HTTP servers with bearer tokens once an environment resolved\nif !cfg.is_local_environment()\n    && cfg.bearer_token_env_var.is_some()\n    && resolved_environment.as_ref().map_or(true, |e| e.is_none())\n{\n    return Err(anyhow::anyhow!(\"no execution environment for {}\", server_name));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register execution environments before publishing configs that reference them","Keep app-server and exec-server versions in lockstep","Smoke-test non-local MCP servers after any environment topology change"],"tags":["mcp","codex","execution-environment","executor","bearer-token","startup","remote-environment"],"backgroundTag":"missing-execution-environment","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}