{"record":{"id":"c2f3109b2c210492","repo":"BigPizzaV3/CodexPlusPlus","slug":"bridge-context-lock-poisoned","errorCode":null,"errorMessage":"bridge context lock poisoned","messagePattern":"bridge context lock poisoned","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/codex-plus-launcher/src/main.rs","lineNumber":41,"sourceCode":"impl Default for LauncherHooks {\n    fn default() -> Self {\n        Self {\n            core: Arc::new(DefaultLaunchHooks::default()),\n            data: Arc::new(LauncherDataService::default()),\n            runtime: Arc::new(LauncherRuntimeService::new(\n                9229,\n                default_user_script_manager(),\n            )),\n            bridge_context: Arc::new(Mutex::new(None)),\n        }\n    }\n}\n\nimpl LauncherHooks {\n    fn watchdog_bridge_context(&self) -> anyhow::Result<BridgeContext> {\n        self.bridge_context\n            .lock()\n            .map_err(|_| anyhow::anyhow!(\"bridge context lock poisoned\"))?\n            .clone()\n            .ok_or_else(|| anyhow::anyhow!(\"bridge context is not initialized\"))\n    }\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let args = std::env::args().skip(1).collect::<Vec<_>>();\n    let helper_only = args.iter().any(|arg| arg == \"--helper-only\");\n    let options = parse_launch_options(args.iter());\n    if let Err(error) = launcher_main(args, helper_only, options.clone()).await {\n        let _ = codex_plus_core::diagnostic_log::append_diagnostic_log(\n            \"launcher.failed\",\n            json!({\n                \"message\": error.to_string()\n            }),\n        );\n        if !helper_only {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/apps/codex-plus-launcher/src/main.rs#L23-L59","documentation":"Thrown by LauncherHooks::watchdog_bridge_context when the Mutex<Option<BridgeContext>> is found poisoned — a previous holder panicked while holding the lock. The offending input is the process-internal lock state (not user data); the watchdog (start_bridge_watchdog) treats a poisoned context as unrecoverable and reports it instead of deadlocking or using a stale context.","triggerScenarios":"Thrown at apps/codex-plus-launcher/src/main.rs:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["查看此前 panic 的日志定位毒化锁的根因","重启 launcher 进程重建 bridge context","改用 lock().unwrap_or_else(|e| e.into_inner()) 容忍毒化锁","排查持锁代码中可 panic 的路径（unwrap/索引越界）"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}