BigPizzaV3/CodexPlusPlus · error · anyhow::Error

bridge context is not initialized

Error message

bridge context is not initialized

What it means

Thrown by LauncherHooks::watchdog_bridge_context when the lock is acquired cleanly but the contained Option<BridgeContext> is None — the bridge was never initialized before the watchdog needed it. The offending input is the uninitialized bridge_context slot; start_bridge_watchdog hits this when it runs ahead of the first bridge setup.

Source

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

        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 {
            let _ = options.status_store.save_latest(&LaunchStatus {
                status: "failed".to_string(),

View on GitHub (pinned to f2074595a2)

Solutions

  1. 等待首次 bridge 连接建立后再启动 watchdog
  2. 检查初始化 bridge_context 的代码路径是否失败或被跳过
  3. 确保 start_bridge_watchdog 在 init 写入 Some(ctx) 之后调用
  4. watchdog 捕获此错误后延迟重试而非直接失败
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at apps/codex-plus-launcher/src/main.rs:43 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/3ef6f3956cba2832. Report an issue: GitHub.