jackwener/OpenCLI · error · CommandExecutionError
Unexpected Doubao probe: ${JSON.stringify(result)}
Error message
Unexpected Doubao probe: ${JSON.stringify(result)} What it means
verifyDoubaoIdentity runs an in-page probe against Doubao's /passport/account/info endpoint and classifies the result as 'auth', 'http', or 'exception'. If the probe returns a result that is not ok and matches none of the known kinds, the function throws this CommandExecutionError as a catch-all. It indicates the in-page probe script returned an unexpected/unrecognized shape, so identity could not be verified.
Source
Thrown at clis/doubao/auth.js:39
if (!res.ok) return { kind: 'http', httpStatus: res.status };
const d = await res.json();
const data = d && d.data;
if (!data || !data.user_id_str) {
return { kind: 'auth', detail: 'Doubao /passport/account/info returned no user_id_str' };
}
return {
ok: true,
user_id: String(data.user_id_str),
name: String(data.name || data.screen_name || ''),
};
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (result?.kind === 'auth') throw new AuthRequiredError('www.doubao.com', result.detail);
if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /passport/account/info`);
if (result?.kind === 'exception') throw new CommandExecutionError(`Doubao whoami failed: ${result.detail}`);
if (!result?.ok) throw new CommandExecutionError(`Unexpected Doubao probe: ${JSON.stringify(result)}`);
return { user_id: result.user_id, name: result.name };
}
registerSiteAuthCommands({
site: 'doubao',
domain: 'www.doubao.com',
loginUrl: 'https://www.doubao.com/chat/',
columns: ['user_id', 'name'],
verify: verifyDoubaoIdentity,
// passport_csrf_token is set for anonymous sessions too, so a cookie gate
// would navigate away mid-login. Probe the account API on the current page
// (no goto) and only confirm once a real user_id is present.
poll: async (page) => {
const loggedIn = await page.evaluate(`(async () => {
try {
const r = await fetch('/passport/account/info/v2/', { credentials: 'include', headers: { Accept: 'application/json' } });
if (!r.ok) return false;
const d = await r.json();View on GitHub (pinned to 49907e53dc)
Solutions
- Re-login to www.doubao.com so the account-info endpoint returns a recognizable response
- Reload the Doubao tab and retry the command after the page fully loads
- Check for Doubao verification/captcha challenges and complete them in the browser
- Update the library to get probe-script fixes for the current Doubao site version
Example fix
// before
if (!result?.ok) throw new CommandExecutionError(`Unexpected Doubao probe: ${JSON.stringify(result)}`);
// after
if (!result?.ok) {
if (result?.kind) throw new CommandExecutionError(`Doubao probe failed (${result.kind}): ${JSON.stringify(result)}`);
throw new CommandExecutionError('Unexpected Doubao probe: page returned no account info; try reloading or re-authenticating');
} Defensive patterns
Strategy: try-catch
Validate before calling
const res = await page.evaluate(probeScript());
if (!res || typeof res !== 'object' || !['auth','http','exception'].includes(res.kind)) {
throw new Error('Doubao probe returned unexpected shape: ' + JSON.stringify(res));
} Type guard
function isProbeResult(r) {
return !!r && typeof r === 'object' && ['auth','http','exception'].includes(r.kind) && typeof r.ok === 'boolean';
} Try / catch
try {
const identity = await verifyDoubaoIdentity(page);
} catch (e) {
if (e instanceof AuthRequiredError) { await runLoginFlow(); }
else if (/Unexpected Doubao probe/.test(e.message)) { await page.reload(); await runLoginFlow(); }
else throw e;
} Prevention
- Keep the Doubao tab fully loaded and free of overlays before probing
- Re-authenticate when account-info responses look unfamiliar
- Log the raw probe result on failure to spot site-format changes early
- Update the library regularly to track Doubao site changes
When it happens
Trigger: The page.evaluate probe returns {ok:false} or an object whose 'kind' is none of 'auth'|'http'|'exception', or result is null/undefined — e.g. Doubao changed the account-info response format, the probe script was interrupted, or an unknown result shape is produced.
Common situations: Doubao site DOM/API changes breaking the probe script; running against a redirected or partially loaded page; anti-bot interstitials altering the response; stale cookies producing unexpected payloads.
Related errors
- Unexpected Boss probe: ${JSON.stringify(probe)}
- Waiting for Doubao login
- Could not find Doubao input element
- 请先在共享 Chrome 完成 1688 登录/验证,再重试(${action})
- 1point3acres Discuz *_auth cookie missing
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/198c0619cf8102df.
Report an issue: GitHub.