BigPizzaV3/CodexPlusPlus · error · SystemExit
缺少 token:请在配置里填写 token,或设置 WEIXIN_TOKEN / ILINK_TOKEN。
Error message
缺少 token:请在配置里填写 token,或设置 WEIXIN_TOKEN / ILINK_TOKEN。
What it means
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.
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at tools/codex-wechat/codex_wechat.py:701 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/9954c4220981208f.
Report an issue: GitHub.
Appendix: source
Thrown at tools/codex-wechat/codex_wechat.py:701
except Exception as exc:
log(f"发送 typing 失败:{exc}")
try:
reply = runner.run(user_id, prompt)
send_text(cfg, user_id, reply, context_token)
finally:
if cfg.enable_typing and typing_ticket:
try:
send_typing(cfg, user_id, typing_ticket, 0)
except Exception:
pass
def poll_loop(cfg: BridgeConfig) -> None:
global LOG_FILE
LOG_FILE = cfg.state_dir / "codex-wechat.log"
if not cfg.token:
raise SystemExit("缺少 token:请在配置里填写 token,或设置 WEIXIN_TOKEN / ILINK_TOKEN。")
if not cfg.allow_all and not cfg.allow_user_ids:
log("未配置 allow_user_ids,除 /id 外不会处理任何用户消息。")
cfg.state_dir.mkdir(parents=True, exist_ok=True)
sync_buf = load_sync_buf(cfg)
seen: dict[str, float] = {}
failures = 0
runner = CodexRunner(cfg)
log(f"启动 Codex 微信助手,base={cfg.base_url},backend={cfg.codex.backend}")
while True:
try:
resp = api_post(
cfg.base_url,
EP_GET_UPDATES,
{"get_updates_buf": sync_buf},
cfg.token,
timeout=cfg.poll_timeout_seconds + 5,View on GitHub (pinned to b1ed92e5e4)