{"record":{"id":"9954c4220981208f","repo":"BigPizzaV3/CodexPlusPlus","slug":"token-token-weixin-token-ilink-token","errorCode":null,"errorMessage":"缺少 token：请在配置里填写 token，或设置 WEIXIN_TOKEN / ILINK_TOKEN。","messagePattern":"缺少 token：请在配置里填写 token，或设置 WEIXIN_TOKEN / ILINK_TOKEN。","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"tools/codex-wechat/codex_wechat.py","lineNumber":701,"sourceCode":"        except Exception as exc:\n            log(f\"发送 typing 失败：{exc}\")\n\n    try:\n        reply = runner.run(user_id, prompt)\n        send_text(cfg, user_id, reply, context_token)\n    finally:\n        if cfg.enable_typing and typing_ticket:\n            try:\n                send_typing(cfg, user_id, typing_ticket, 0)\n            except Exception:\n                pass\n\n\ndef poll_loop(cfg: BridgeConfig) -> None:\n    global LOG_FILE\n    LOG_FILE = cfg.state_dir / \"codex-wechat.log\"\n    if not cfg.token:\n        raise SystemExit(\"缺少 token：请在配置里填写 token，或设置 WEIXIN_TOKEN / ILINK_TOKEN。\")\n    if not cfg.allow_all and not cfg.allow_user_ids:\n        log(\"未配置 allow_user_ids，除 /id 外不会处理任何用户消息。\")\n\n    cfg.state_dir.mkdir(parents=True, exist_ok=True)\n    sync_buf = load_sync_buf(cfg)\n    seen: dict[str, float] = {}\n    failures = 0\n    runner = CodexRunner(cfg)\n\n    log(f\"启动 Codex 微信助手，base={cfg.base_url}，backend={cfg.codex.backend}\")\n    while True:\n        try:\n            resp = api_post(\n                cfg.base_url,\n                EP_GET_UPDATES,\n                {\"get_updates_buf\": sync_buf},\n                cfg.token,\n                timeout=cfg.poll_timeout_seconds + 5,","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/codex-wechat/codex_wechat.py#L683-L719","documentation":"poll_loop refuses to start when the resolved BridgeConfig has an empty token field. Token resolution (config file or WEIXIN_TOKEN/ILINK_TOKEN env vars) failed, so every WeChat API call would be rejected with auth errors; this is an upfront fail-fast guard.","triggerScenarios":"Thrown at tools/codex-wechat/codex_wechat.py:701 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set token in the bridge config JSON under the top-level token field.","Export the WEIXIN_TOKEN or ILINK_TOKEN environment variable before launching the bridge.","Re-run the qr_login flow to obtain a fresh token if the old one was revoked."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}