BigPizzaV3/CodexPlusPlus · error · anyhow::Error

bridge context lock poisoned

Error message

bridge context lock poisoned

What it means

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.

Source

Thrown at apps/codex-plus-launcher/src/main.rs:41

impl Default for LauncherHooks {
    fn default() -> Self {
        Self {
            core: Arc::new(DefaultLaunchHooks::default()),
            data: Arc::new(LauncherDataService::default()),
            runtime: Arc::new(LauncherRuntimeService::new(
                9229,
                default_user_script_manager(),
            )),
            bridge_context: Arc::new(Mutex::new(None)),
        }
    }
}

impl LauncherHooks {
    fn watchdog_bridge_context(&self) -> anyhow::Result<BridgeContext> {
        self.bridge_context
            .lock()
            .map_err(|_| anyhow::anyhow!("bridge context lock poisoned"))?
            .clone()
            .ok_or_else(|| anyhow::anyhow!("bridge context is not initialized"))
    }
}

#[tokio::main]
async fn main() -> Result<()> {
    let args = std::env::args().skip(1).collect::<Vec<_>>();
    let helper_only = args.iter().any(|arg| arg == "--helper-only");
    let options = parse_launch_options(args.iter());
    if let Err(error) = launcher_main(args, helper_only, options.clone()).await {
        let _ = codex_plus_core::diagnostic_log::append_diagnostic_log(
            "launcher.failed",
            json!({
                "message": error.to_string()
            }),
        );
        if !helper_only {

View on GitHub (pinned to f2074595a2)

Solutions

  1. 查看此前 panic 的日志定位毒化锁的根因
  2. 重启 launcher 进程重建 bridge context
  3. 改用 lock().unwrap_or_else(|e| e.into_inner()) 容忍毒化锁
  4. 排查持锁代码中可 panic 的路径(unwrap/索引越界)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at apps/codex-plus-launcher/src/main.rs:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/c2f3109b2c210492. Report an issue: GitHub.