{"record":{"id":"cb4a2bf38bfb2a5b","repo":"openai/codex","slug":"app-server-is-running-but-is-not-managed-by-codex","errorCode":null,"errorMessage":"app server is running but is not managed by codex app-server daemon","messagePattern":"app server is running but is not managed by codex app-server daemon","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/app-server-daemon/src/lib.rs","lineNumber":340,"sourceCode":"        self.ensure_managed_codex_bin()?;\n        let pid = self.start_managed_backend(&settings).await?;\n        let info = self.wait_until_ready().await?;\n        Ok(self\n            .output(\n                LifecycleStatus::Started,\n                Some(BackendKind::Pid),\n                pid,\n                Some(info.app_server_version),\n            )\n            .await)\n    }\n\n    async fn restart(&self) -> Result<LifecycleOutput> {\n        let settings = self.load_settings().await?;\n        if client::probe(&self.socket_path).await.is_ok()\n            && self.running_backend(&settings).await?.is_none()\n        {\n            return Err(anyhow!(\n                \"app server is running but is not managed by codex app-server daemon\"\n            ));\n        }\n\n        self.ensure_managed_codex_bin()?;\n        if let Some(backend) = self.running_backend_instance(&settings).await? {\n            backend.stop().await?;\n        }\n\n        let pid = self.start_managed_backend(&settings).await?;\n        let info = self.wait_until_ready().await?;\n        Ok(self\n            .output(\n                LifecycleStatus::Restarted,\n                Some(BackendKind::Pid),\n                pid,\n                Some(info.app_server_version),\n            )","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/app-server-daemon/src/lib.rs#L322-L358","documentation":"During restart, the daemon probed the socket and found a live app-server, but the recorded backend state shows it was not started by this daemon (no matching managed pid backend), so the daemon refuses to restart a process it does not own.","triggerScenarios":"Thrown at codex-rs/app-server-daemon/src/lib.rs:340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Stop the externally started app-server (e.g. `pkill` the codex app-server process) so the daemon can start its own managed backend","Re-run `codex app-server-daemon start` after the unmanaged server is gone"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}