jackwener/OpenCLI · error · CommandExecutionError
Unexpected Quark probe: ${JSON.stringify(probe)}
Error message
Unexpected Quark probe: ${JSON.stringify(probe)} What it means
Fallback branch of verifyQuarkIdentity: if the WHOAMI_PROBE result is neither ok nor one of the recognized kinds (auth/http/render-error/exception), the probe object is serialized into this CommandExecutionError. It guards against unknown or malformed probe responses so failures are never silently swallowed.
Source
Thrown at clis/quark/auth.js:32
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
- Inspect the JSON in the message to see the unexpected probe shape returned by the page.
- Update the automation library so WHOAMI_PROBE matches the current Quark page/API contract.
- Add an explicit retry with a longer wait in case the probe ran before the page finished initializing.
- Reproduce by evaluating WHOAMI_PROBE manually in the automated browser to see raw output.
- Check whether a login redirect landed on an unexpected page so the probe ran in the wrong context.
Defensive patterns
Strategy: type-guard
Validate before calling
const probe = await page.evaluate(WHOAMI_PROBE);
if (!probe || typeof probe !== 'object' || !('ok' in probe) && !('kind' in probe)) {
throw new Error('WHOAMI_PROBE returned malformed data — check library version vs Quark UI');
} Type guard
function isWellFormedProbe(p) {
return !!p && typeof p === 'object' &&
(p.ok === true || ['auth','http','render-error','exception'].includes(p.kind));
} Try / catch
try {
await verifyQuarkIdentity(page);
} catch (e) {
if (/Unexpected Quark probe:/.test(String(e.message))) {
// log full message JSON, re-run login flow, and update tooling
} else throw e;
} Prevention
- Keep the automation library in sync with Quark's frontend
- Always log the serialized probe payload from the error message
- Verify the page is on pan.quark.cn (not a redirect) before probing
- Add a smoke test that asserts the probe's return shape weekly
When it happens
Trigger: page.evaluate(WHOAMI_PROBE) returns null/undefined or an object lacking the expected kind/ok fields during quark identity verification.
Common situations: Quark frontend update changing the probe's return shape; evaluate returning undefined due to script error swallowed by the probe; version mismatch between the automation tool and the current pan.quark.cn page.
Related errors
- ${probe.detail}
- Quark whoami failed: ${probe.detail}
- Unexpected Toutiao probe: ${JSON.stringify(probe)}
- Unexpected Amazon probe: ${JSON.stringify(probe)}
- Unexpected Douban probe: ${JSON.stringify(probe)}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6e71d4a7fa8830bc.
Report an issue: GitHub.