jackwener/OpenCLI · error · CommandExecutionError
Quark whoami failed: ${probe.detail}
Error message
Quark whoami failed: ${probe.detail} What it means
When the WHOAMI_PROBE in the Quark page throws or reports an in-page exception, verifyQuarkIdentity wraps it as CommandExecutionError with the prefix 'Quark whoami failed:'. The detail is the exception message captured inside page context. It indicates the probe script itself failed while executing, rather than the API returning a bad status or auth redirect.
Source
Thrown at clis/quark/auth.js:31
const data = d && d.data;
const isEmpty = !data || Array.isArray(data) || Object.keys(data).length === 0;
if (isEmpty) return { kind: 'auth', detail: 'Quark account/info returned empty data — anonymous' };
const nickname = String(data.nickname || data.nick_name || data.name || '');
if (!nickname) return { kind: 'render-error', detail: 'Quark account/info populated but no nickname field — response shape drift' };
return { ok: true, nickname };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`;
async function verifyQuarkIdentity(page) {
await page.goto('https://pan.quark.cn/');
await page.wait(2);
const probe = await page.evaluate(WHOAMI_PROBE);
if (probe?.kind === 'auth') throw new AuthRequiredError('quark.cn', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Quark account/info`);
if (probe?.kind === 'render-error') throw new CommandExecutionError(probe.detail);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Quark whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Quark probe: ${JSON.stringify(probe)}`);
return { nickname: probe.nickname };
}
registerSiteAuthCommands({
site: 'quark',
domain: 'quark.cn',
loginUrl: 'https://pan.quark.cn/',
columns: ['nickname'],
verify: verifyQuarkIdentity,
poll: async (page) => {
const probe = await page.evaluate(WHOAMI_PROBE);
if (!probe?.ok) throw new AuthRequiredError('quark.cn', 'Waiting for Quark login');
return { nickname: probe.nickname };
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Read the detail suffix in the message to identify the exact in-page exception.
- Increase the initial wait or retry once, letting the SPA finish loading before probing.
- Manually load pan.quark.cn in the automated browser and run the probe steps to reproduce and debug the exception.
- Update the library if Quark's frontend changed the globals/endpoint the probe depends on.
- Check for browser extensions or CSP headers interfering with page scripts and disable them.
Example fix
// before
await page.goto('https://pan.quark.cn/');
await page.wait(2);
const probe = await page.evaluate(WHOAMI_PROBE);
// after
await page.goto('https://pan.quark.cn/');
await page.wait(5); // give the SPA more time to initialize before probing
const probe = await page.evaluate(WHOAMI_PROBE); Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the SPA finished booting before probing
await page.goto('https://pan.quark.cn/');
await page.waitForFunction(() => document.readyState === 'complete', { timeout: 20000 }); Type guard
function isExceptionProbe(p) {
return !!p && typeof p === 'object' && p.kind === 'exception' && typeof p.detail === 'string';
} Try / catch
try {
await verifyQuarkIdentity(page);
} catch (e) {
if (/Quark whoami failed:/.test(String(e.message))) {
await page.reload(); await page.wait(5);
await verifyQuarkIdentity(page); // single retry after reload
} else throw e;
} Prevention
- Wait for page readiness/network idle before evaluating probes
- Disable interfering browser extensions in the automation profile
- Update the tool when Quark's frontend changes globals the probe uses
- Capture the detail suffix for debugging before retrying
When it happens
Trigger: page.evaluate(WHOAMI_PROBE) returns {kind:'exception', detail} during quark identity verification — e.g. the probe's fetch or DOM access threw inside the page (network failure, undefined API object, CSP block).
Common situations: Quark SPA not fully loaded so probe-referenced globals are missing; fetch blocked by extensions/CSP; intermittent network failure from the browser; Quark frontend refactor removing objects the probe uses.
Related errors
- ${probe.detail}
- Unexpected Quark probe: ${JSON.stringify(probe)}
- Barchart greeks request failed: ${data.message || 'unknown e
- Unexpected Gemini probe: ${JSON.stringify(probe)}
- HTTP ${probe.httpStatus} from Quark account/info
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/17af0a9fb8a3d4ed.
Report an issue: GitHub.