{"record":{"id":"cceedcb3456f7ac5","repo":"openai/codex","slug":"mcp-server-server-is-not-registered-by-the-hos","errorCode":null,"errorMessage":"MCP server '{server}' is not registered by the hosted runtime","messagePattern":"MCP server '(.+?)' is not registered by the hosted runtime","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/runtime.rs","lineNumber":562,"sourceCode":"\n    pub(crate) fn latest_connections_for_event_server(\n        &self,\n        server: &str,\n    ) -> anyhow::Result<(Arc<McpConnectionSet>, watch::Receiver<()>)> {\n        let hosted_event_server_removals = self.hosted_event_server_removals.subscribe();\n        let current = self.current.load();\n        if server == CODEX_APPS_MCP_SERVER_NAME\n            && !current\n                .config\n                .as_ref()\n                .and_then(|config| config.mcp_server_catalog.server(server))\n                .is_some_and(|registration| {\n                    registration\n                        .source()\n                        .is_host_owned_apps(server, registration.config())\n                })\n        {\n            anyhow::bail!(\"MCP server '{server}' is not registered by the hosted runtime\");\n        }\n        Ok((\n            Arc::clone(&current.connections),\n            hosted_event_server_removals,\n        ))\n    }\n\n    pub async fn shutdown(&self) {\n        self.latest_connections().shutdown().await;\n    }\n}\n\n#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct SandboxState {\n    pub permission_profile: PermissionProfile,\n    pub codex_linux_sandbox_exe: Option<PathBuf>,\n    pub sandbox_cwd: PathUri,","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/runtime.rs#L544-L580","documentation":"latest_connections_for_event_server gates event-stream access (list_events / open_event_stream) for the reserved name codex_apps: it only succeeds when the published catalog holds a host-owned apps registration under that exact name. The bail fires when that name is requested but no host-owned registration exists - typically a user-defined server shadowing the reserved name, or the hosted registration not yet published.","triggerScenarios":"Calling list_events or open_event_stream with server = \"codex_apps\" while config.toml also defines a user-level [mcp_servers.codex_apps] entry (so the catalog entry is not host-owned), or before the hosted runtime has published its apps registration after startup or a config replace.","commonSituations":"Users naming their own server 'codex_apps' not realizing it is reserved; opening the apps event stream immediately at startup before publication completes.","solutions":["Rename the user-defined server in config.toml from codex_apps to anything else and restart","Remove the conflicting [mcp_servers.codex_apps] entry so only the hosted registration owns the name","If it is a startup race, retry after the runtime publishes registrations (await the ready signal before opening the stream)"],"exampleFix":"# before: user server shadows the reserved hosted name\n[mcp_servers.codex_apps]\nurl = \"https://my-server.example/mcp\"\n\n# after\n[mcp_servers.my_apps_bridge]\nurl = \"https://my-server.example/mcp\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match runtime.latest_connections_for_event_server(server) {\n    Ok((connections, removals)) => { /* open the event stream */ }\n    Err(err) if err.to_string().contains(\"not registered by the hosted runtime\") => { /* rename the conflicting config entry or skip the stream */ }\n    Err(err) => return Err(err),\n}","preventionTips":["Never use the reserved name codex_apps for user-configured MCP servers","Lint configs against the reserved server-name list","Open hosted event streams only after the runtime has published its catalog"],"tags":["mcp","codex","codex-apps","reserved-name","event-stream","registration","config"],"backgroundTag":"reserved-name-conflict","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}