BigPizzaV3/CodexPlusPlus · error · anyhow::Error

微信连接运行锁已损坏

Error message

微信连接运行锁已损坏

What it means

Thrown in spawn_weixin_connect after the token check when acquiring/validating the WeChat connect runtime lock fails because its persisted lock state is unreadable or corrupt (e.g. half-written flag from a crash). The offending input is the on-disk run-lock for the WeChat connect feature; the code treats a damaged lock as fatal for startup instead of guessing whether a previous instance is alive.

Source

Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:1190

    let config = codex_plus_core::connect::WeixinConnectConfig {
        base_url: settings.weixin_connect_base_url,
        token: settings.weixin_connect_token,
        account_id: settings.weixin_connect_account_id,
        allow_from: settings.weixin_connect_allow_from,
        route_tag: settings.weixin_connect_route_tag,
        work_dir: settings.weixin_connect_work_dir,
        model: settings.weixin_connect_model,
        sandbox: settings.weixin_connect_sandbox,
        codex_path: settings.weixin_connect_codex_path,
    }
    .normalized();
    if config.token.is_empty() {
        anyhow::bail!("微信连接 token 为空");
    }
    let stop = Arc::new(AtomicBool::new(false));
    let mut runtime = weixin_runtime()
        .lock()
        .map_err(|_| anyhow::anyhow!("微信连接运行锁已损坏"))?;
    if runtime.is_some() {
        anyhow::bail!("微信连接已在运行或正在停止");
    }
    *runtime = Some(WeixinRuntime {
        stop: Arc::clone(&stop),
    });
    drop(runtime);
    let status = weixin_status();
    if let Ok(mut current) = status.lock() {
        current.state = "starting".to_string();
        current.message = "正在启动微信连接...".to_string();
        current.account_id = config.account_id.clone();
        current.has_token = true;
    }
    let task_status = Arc::clone(&status);
    let task_stop = Arc::clone(&stop);
    tauri::async_runtime::spawn(async move {
        if let Err(error) = codex_plus_core::connect::run_weixin_connect(

View on GitHub (pinned to f2074595a2)

Solutions

  1. 查看此前 panic 的日志定位毒化根因
  2. 重启管理器应用恢复锁状态
  3. 改用 into_inner() 容忍毒化锁或加入锁恢复机制
  4. 排查持锁代码中的 unwrap 等可 panic 点
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:1190 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/6092e398764980b3. Report an issue: GitHub.