{"record":{"id":"de8bccfedc496069","repo":"BigPizzaV3/CodexPlusPlus","slug":"token","errorCode":null,"errorMessage":"微信连接 token 为空","messagePattern":"微信连接 token 为空","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/codex-plus-manager/src-tauri/src/commands.rs","lineNumber":1481,"sourceCode":"}\n\nfn spawn_weixin_connect(\n    settings: BackendSettings,\n) -> anyhow::Result<codex_plus_core::connect::WeixinConnectStatus> {\n    let config = codex_plus_core::connect::WeixinConnectConfig {\n        base_url: settings.weixin_connect_base_url,\n        token: settings.weixin_connect_token,\n        account_id: settings.weixin_connect_account_id,\n        allow_from: settings.weixin_connect_allow_from,\n        route_tag: settings.weixin_connect_route_tag,\n        work_dir: settings.weixin_connect_work_dir,\n        model: settings.weixin_connect_model,\n        sandbox: settings.weixin_connect_sandbox,\n        codex_path: settings.weixin_connect_codex_path,\n    }\n    .normalized();\n    if config.token.is_empty() {\n        anyhow::bail!(\"微信连接 token 为空\");\n    }\n    let stop = Arc::new(AtomicBool::new(false));\n    let mut runtime = weixin_runtime()\n        .lock()\n        .map_err(|_| anyhow::anyhow!(\"微信连接运行锁已损坏\"))?;\n    if runtime.is_some() {\n        anyhow::bail!(\"微信连接已在运行或正在停止\");\n    }\n    let codex_path = codex_plus_core::connect::WeixinCodexPath::new(&config.codex_path);\n    *runtime = Some(WeixinRuntime {\n        stop: Arc::clone(&stop),\n        codex_path: codex_path.clone(),\n    });\n    drop(runtime);\n    let status = weixin_status();\n    if let Ok(mut current) = status.lock() {\n        current.state = \"starting\".to_string();\n        current.message = \"正在启动微信连接...\".to_string();","sourceCodeStart":1463,"sourceCodeEnd":1499,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/apps/codex-plus-manager/src-tauri/src/commands.rs#L1463-L1499","documentation":"The WeChat connect runtime requires a connection token. After normalizing the WeixinConnectConfig built from settings (token/model/sandbox/codex_path), the token field is checked and the command bails if it is empty, because the relay cannot authenticate without it.","triggerScenarios":"Calling the WeChat connect start command (commands.rs ~1481) when settings.weixin_connect_token resolves to an empty string after normalized().","commonSituations":"User saved WeChat connect settings without pasting a token; token field was cleared in the UI; settings file migrated/created with default (empty) weixin_connect_token.","solutions":["Open manager settings and fill in the WeChat connect token, then retry the connect command","Validate settings.weixin_connect_token before invoking the connect command","If the settings file lost the token, re-enter it and save so it persists"],"exampleFix":"// before\nstart_weixin_connect();\n// after\nif (!settings.weixinConnectToken) throw new Error(\"fill in weixin token first\");\nstart_weixin_connect();","handlingStrategy":"validation","validationCode":"if (!settings.weixinConnectToken || settings.weixinConnectToken.trim() === '') throw new Error('weixin token required');","typeGuard":null,"tryCatchPattern":"try { await invoke('weixin_connect_start') } catch (e) { if (String(e).includes('token 为空')) openTokenSettings(); else throw e; }","preventionTips":["Mark the token field required in the settings form","Validate settings before persisting","Disable the connect button until a token is entered"],"tags":["weixin","validation","missing-token"],"backgroundTag":"empty-required-field","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}