jackwener/OpenCLI · error · CommandExecutionError
Unexpected Jianyu probe: ${JSON.stringify(probe)}
Error message
Unexpected Jianyu probe: ${JSON.stringify(probe)} What it means
CommandExecutionError thrown by verifyJianyuIdentity when the probe returns a result that is neither kind:'auth', kind:'exception', nor ok:true — i.e. an unrecognized probe shape. The message embeds the full JSON of the probe result for diagnosis. This guards against the probe contract drifting (e.g. a null/undefined probe if page.evaluate returned nothing, or a future probe variant returning new kinds).
Source
Thrown at clis/jianyu/auth.js:45
try {
const u = JSON.parse(userScript);
userId = userId || String(u.id || u.userId || '');
name = String(u.name || u.realName || u.nickName || '');
} catch {}
}
const cookieUid = (document.cookie.split('; ').find(c => c.startsWith('userid_secure=')) || '').split('=')[1] || '';
userId = userId || cookieUid;
if (!userId && !name) {
return { kind: 'auth', detail: 'Jianyu protected page 200 but no user identity surface' };
}
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('jianyu360.cn', probe.detail);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Jianyu whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jianyu probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, name: probe.name };
}
registerSiteAuthCommands({
site: 'jianyu',
domain: 'jianyu360.cn',
loginUrl: 'https://www.jianyu360.cn/',
columns: ['user_id', 'name'],
quickCheck: hasJianyuUserCookie,
verify: verifyJianyuIdentity,
poll: async (page) => {
if (!await hasJianyuUserCookie(page)) {
throw new AuthRequiredError('jianyu360.cn', 'Waiting for Jianyu userid_secure cookie');
}
return verifyJianyuIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the JSON in the error message to see the actual probe value returned
- If probe is null/undefined, ensure the page stays on www.jianyu360.cn (no redirect) during evaluation and that page.evaluate awaits the async IIFE properly
- If you customized the probe, update the dispatch in verifyJianyuIdentity to handle the new kind or return { ok: true, ... }
- Re-run verify after fixing the evaluation harness; confirm quickCheck (userid_secure cookie) passes first
Example fix
// before: probe returns new shape { loggedIn: true, userId } without ok
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jianyu probe: ${JSON.stringify(probe)}`);
// after: normalize new shape
if (probe?.loggedIn) return { user_id: probe.userId, name: probe.name || '' };
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jianyu probe: ${JSON.stringify(probe)}`); Defensive patterns
Strategy: validation
Validate before calling
const probe = await page.evaluate(probeScript);
if (probe == null || typeof probe !== 'object' || !('kind' in probe)) {
throw new Error('Probe returned no result — page likely navigated during evaluation');
} Type guard
function isKnownProbeResult(probe) {
return probe != null && typeof probe === 'object' &&
(probe.kind === 'auth' || probe.kind === 'exception' || probe.ok === true);
} Try / catch
try {
return await verifyJianyuIdentity(page);
} catch (e) {
if (/Unexpected Jianyu probe: null/.test(e.message)) {
await page.goto('https://www.jianyu360.cn/'); // re-anchor and retry once
return verifyJianyuIdentity(page);
}
throw e;
} Prevention
- Never navigate the page concurrently with the probe evaluation
- If you modify the probe script, keep its return contract in sync with the dispatch branches
- Log the embedded probe JSON in the message before discarding the error
- Add a unit test asserting the probe result contract
When it happens
Trigger: page.evaluate returns null/undefined because the async IIFE result was not serialized or the page navigated mid-evaluation; or the probe code was modified to return a new result shape without updating the kind dispatch in verifyJianyuIdentity.
Common situations: Upgrading or locally patching the probe script and forgetting to add a matching branch; page redirects during page.evaluate causing undefined return; browser automation layer returning undefined for async evaluations.
Related errors
- Jianyu whoami failed: ${probe.detail}
- Not a git repository
- AIbase daily selector drift: ${reason}
- Booking.com extractor returned an invalid status
- Unexpected Boss probe: ${JSON.stringify(probe)}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e58536eb9a3a1fd9.
Report an issue: GitHub.