jackwener/OpenCLI · error · CommandExecutionError
Unexpected WeChat Channels probe: ${JSON.stringify(probe)}
Error message
Unexpected WeChat Channels probe: ${JSON.stringify(probe)} What it means
Final sanity check: if the probe result is none of the known kinds ('auth'/'http'/'exception') and lacks ok:true, the tool throws this CommandExecutionError embedding the raw probe object. This guards against unexpected probe shapes — including probe being null/undefined when page.evaluate returned nothing.
Source
Thrown at clis/wechat-channels/auth.js:45
const d = await r.json();
if (!d || d.base_resp?.ret !== 0) {
return { kind: 'auth', detail: 'WeChat Channels auth_data base_resp.ret=' + String(d?.base_resp?.ret) };
}
const fu = d.data?.finder_user || d.finder_user || {};
const userId = String(fu.uniq_id || fu.username || '');
const name = String(fu.nickname || fu.name || '');
if (!userId && !name) {
return { kind: 'auth', detail: 'WeChat Channels auth_data 200 but finder_user empty' };
}
return { ok: true, user_id: userId, name };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (probe?.kind === 'auth') throw new AuthRequiredError('channels.weixin.qq.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from auth_data`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`WeChat Channels whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected WeChat Channels probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, name: probe.name };
}
registerSiteAuthCommands({
site: 'wechat-channels',
domain: 'channels.weixin.qq.com',
loginUrl: 'https://channels.weixin.qq.com/login.html?from=assistant',
columns: ['user_id', 'name'],
quickCheck: hasWechatChannelsSessionCookie,
verify: verifyWechatChannelsIdentity,
poll: async (page) => {
if (!await hasWechatChannelsSessionCookie(page)) {
throw new AuthRequiredError('channels.weixin.qq.com', 'Waiting for WeChat Channels sessionid cookie');
}
return verifyWechatChannelsIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the JSON in the message to see what the probe actually returned.
- Retry — a torn-down evaluation context is often transient.
- Ensure the platform page stays open and fully loaded during verification (avoid navigating away).
- Update the CLI — the probe schema may have changed server-side and needs a newer probe script.
- If it reproduces, capture the page state (URL, cookies) and file a bug with the probe JSON.
Example fix
// before
const probe = await page.evaluate(`(async () => { ... })()`); // may return undefined
// after
const probe = await page.evaluate(`(async () => { ... })()`);
if (!probe) throw new CommandExecutionError('Probe did not return; page may have navigated — retry'); Defensive patterns
Strategy: try-catch
Validate before calling
// Guard the raw probe yourself if calling internals:
const probe = await page.evaluate(probeScript);
if (probe == null) throw new Error('Probe returned nothing — page navigated or closed; retry'); Type guard
function isKnownProbe(p) { return p != null && typeof p === 'object' && ('ok' in p || ['auth','http','exception'].includes(p.kind)); } Try / catch
try {
const identity = await verifyWechatChannelsIdentity(page);
} catch (e) {
if (/Unexpected WeChat Channels probe/.test(e.message)) {
console.error('Raw probe:', e.message); // capture for bug report
return verifyWechatChannelsIdentity(page); // single retry for torn-down contexts
}
throw e;
} Prevention
- Keep the page open and idle during verification
- Retry once — undefined probes usually mean a navigation race
- Keep the CLI updated; server response schema may drift
- Log the embedded probe JSON when filing bugs
When it happens
Trigger: page.evaluate returns null/undefined (page closed or navigated before the async IIFE resolved); a future/unknown probe response shape; the evaluate serialization dropped the result object.
Common situations: Slow page where the async probe hadn't resolved and the context tore down; automation framework returning undefined for pending promises; version mismatch between the probe script and expected result schema.
Related errors
- Unexpected Douban probe: ${JSON.stringify(probe)}
- Unexpected NotebookLM probe: ${JSON.stringify(probe)}
- Unexpected Quark probe: ${JSON.stringify(probe)}
- Unexpected Toutiao probe: ${JSON.stringify(probe)}
- WeChat Channels whoami failed: ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c74c5cf1ac169be4.
Report an issue: GitHub.