jackwener/OpenCLI · error · CommandExecutionError
Jimeng whoami failed: ${probe.detail}
Error message
Jimeng whoami failed: ${probe.detail} What it means
If the WHOAMI_PROBE script itself throws while executing in the page (kind 'exception'), verifyJimengIdentity wraps it as CommandExecutionError('Jimeng whoami failed: <detail>'). The identity check could not even complete, indicating a scripting or page-state problem rather than an auth or HTTP issue.
Source
Thrown at clis/jimeng/auth.js:30
const r = await fetch('/passport/account/info/v2/?aid=513695', { credentials: 'include', headers: { Accept: 'application/json' } });
if (r.status === 401 || r.status === 403) return { kind: 'auth', detail: 'Jimeng passport HTTP ' + r.status };
if (!r.ok) return { kind: 'http', httpStatus: r.status };
const d = await r.json();
const u = d && d.data;
if (!u || !u.user_id || u.is_visitor_account) return { kind: 'auth', detail: 'Jimeng passport returned a visitor account (anonymous)' };
return { ok: true, user_id: String(u.user_id_str || u.user_id), screen_name: String(u.screen_name || u.name || '') };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`;
async function verifyJimengIdentity(page) {
await page.goto('https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0');
await page.wait(2);
const probe = await page.evaluate(WHOAMI_PROBE);
if (probe?.kind === 'auth') throw new AuthRequiredError('jimeng.jianying.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Jimeng passport`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Jimeng whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jimeng probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, screen_name: probe.screen_name };
}
registerSiteAuthCommands({
site: 'jimeng',
domain: 'jimeng.jianying.com',
loginUrl: 'https://jimeng.jianying.com/',
columns: ['user_id', 'screen_name'],
verify: verifyJimengIdentity,
poll: async (page) => {
const probe = await page.evaluate(WHOAMI_PROBE);
if (!probe?.ok) throw new AuthRequiredError('jimeng.jianying.com', 'Waiting for Jimeng login');
return { user_id: probe.user_id, screen_name: probe.screen_name };
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Reload the Jimeng page and ensure it fully loads before the probe runs (increase the wait after page.goto)
- Read probe.detail in the message for the underlying JS error
- Verify the page URL is jimeng.jianying.com (not a redirect/error page) before evaluating
- Update the CLI/WHOAMI_PROBE if Jimeng changed its page structure
- Disable extensions that inject scripts or block requests on the page
Example fix
// before
const probe = await page.evaluate(WHOAMI_PROBE);
// after
await page.goto('https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0');
await page.wait(5); // give SPA more time before probing
const probe = await page.evaluate(WHOAMI_PROBE); Defensive patterns
Strategy: try-catch
Validate before calling
if (!page.url().includes('jimeng.jianying.com')) throw new Error('Probe must run on jimeng.jianying.com — navigate first'); Type guard
function isProbeException(err) {
return err instanceof CommandExecutionError && err.message.startsWith('Jimeng whoami failed:');
} Try / catch
try {
const identity = await verifyJimengIdentity(page);
} catch (err) {
if (isProbeException(err)) {
console.error('In-page probe crashed:', err.message); // inspect detail, reload page and retry
}
throw err;
} Prevention
- Wait for the SPA to finish loading before page.evaluate
- Assert the page URL is on jimeng.jianying.com before probing
- Keep WHOAMI_PROBE in sync with Jimeng's page structure
- Return only serializable values from in-page scripts
When it happens
Trigger: page.evaluate(WHOAMI_PROBE) rejects or the probe's try/catch returns kind 'exception' — e.g. the page failed to load fully, the probe references APIs removed from the page context, CSP blocks the fetch, or the page was navigated away mid-probe.
Common situations: Page still loading or redirected to another URL when the probe runs; Jimeng front-end update changing global objects the probe depends on; browser extension or CSP interfering; stale tab with an error page.
Related errors
- ${label}: ${String(payload.error)}
- ${label} returned malformed extraction payload
- coupang add-to-cart evaluation failed: ${error?.message || e
- Douyin search: unexpected evaluator payload shape
- ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1c50152d15732e8d.
Report an issue: GitHub.