BigPizzaV3/CodexPlusPlus · error
请先扫码登录微信
Error message
请先扫码登录微信
What it means
run_weixin_connect_with_codex_path refuses to start the WeChat bridge when the stored WeChat login token is empty. The token is produced by the QR-code login flow; without it the bridge cannot authenticate requests to the WeChat API. This is a deliberate pre-flight guard so the connect flow fails fast with a user-actionable message instead of failing later on an unauthenticated HTTP call.
Solutions
- Complete the WeChat QR-code login flow first (fetch_qr_code + poll_qr_status) to obtain and persist the token
- Inspect the stored WeixinConfig and confirm `token` is populated before calling connect
- Re-scan the QR code if the saved token expired or was cleared
Example fix
// before
run_weixin_connect(config).await?;
// after
if config.normalized().token.is_empty() {
let login = weixin_login_flow().await?; // performs QR login, stores token
config.token = login.token;
}
run_weixin_connect(config).await?; Defensive patterns
Strategy: validation
Validate before calling
if config.normalized().token.is_empty() {
return Err(anyhow!("请先完成微信扫码登录后再连接"));
} Type guard
fn has_weixin_token(c: &WeixinConfig) -> bool { !c.normalized().token.trim().is_empty() } Try / catch
match run_weixin_connect(config).await {
Err(e) if e.to_string().contains("请先扫码登录微信") => prompt_qr_login(),
other => other,
} Prevention
- Always run the QR login flow before connect
- Persist the token after login and reload it on startup
- Surface login state in the UI so connect isn't attempted while logged out
When it happens
Trigger: Calling run_weixin_connect (or run_weixin_connect_with_codex_path) with a WeixinConfig whose `token` field is an empty string after normalization.
Common situations: Fresh install where the user never completed QR-code login; config file reset or migrated without the token field; a previous logout cleared the token but an automation still invokes connect.
Related errors
- 供应商配置总开关已关闭,未写入 config.toml / auth.json。
- 微信连接已停止
- model_auto_compact 的模型
- 工作目录不存在:
- Ambiguous runtime selection; no cache was modified
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/838e7ec4138af239.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/connect/mod.rs:144
pub async fn run_weixin_connect(
config: WeixinConnectConfig,
stop: Arc<AtomicBool>,
status: SharedWeixinConnectStatus,
) -> anyhow::Result<()> {
let codex_path = WeixinCodexPath::new(&config.codex_path);
run_weixin_connect_with_codex_path(config, stop, status, codex_path).await
}
pub async fn run_weixin_connect_with_codex_path(
config: WeixinConnectConfig,
stop: Arc<AtomicBool>,
status: SharedWeixinConnectStatus,
codex_path: WeixinCodexPath,
) -> anyhow::Result<()> {
let config = config.normalized();
if config.token.is_empty() {
bail!("请先扫码登录微信");
}
let work_dir = if config.work_dir.is_empty() {
std::env::current_dir().context("无法读取当前工作目录")?
} else {
PathBuf::from(&config.work_dir)
};
if !work_dir.is_dir() {
bail!("工作目录不存在:{}", work_dir.display());
}
update_status(&status, |current| {
current.state = "starting".to_string();
current.message = "正在连接微信和 Codex app-server...".to_string();
current.account_id = config.account_id.clone();
current.has_token = true;
});
let client = WeixinClient::new(&config.base_url, &config.token, &config.route_tag)?;View on GitHub (pinned to b1ed92e5e4)