jackwener/OpenCLI · error · CommandExecutionError
Gitee whoami failed: ${probe.detail}
Error message
Gitee whoami failed: ${probe.detail} What it means
In verifyGiteeIdentity (clis/gitee/auth.js), when the in-page WHOAMI_PROBE fetch itself throws (network failure, CORS, aborted request, JSON fetch exception), the probe returns kind 'exception' with the browser-side error text, and this CommandExecutionError wraps it as 'Gitee whoami failed: <detail>'. It means the identity probe could not complete at all, as opposed to receiving an HTTP response.
Source
Thrown at clis/gitee/auth.js:25
try {
const r = await fetch('/api/v5/user', { credentials: 'include', headers: { Accept: 'application/json' } });
if (r.status === 401 || r.status === 403) return { kind: 'auth', detail: 'Gitee /api/v5/user HTTP ' + r.status };
if (!r.ok) return { kind: 'http', httpStatus: r.status };
const d = await r.json();
if (!d || !d.id || !d.login) return { kind: 'auth', detail: 'Gitee /api/v5/user has no id/login — anonymous' };
return { ok: true, user_id: String(d.id), username: String(d.login), name: String(d.name || '') };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`;
async function verifyGiteeIdentity(page) {
await page.goto('https://gitee.com/');
await page.wait(1);
const probe = await page.evaluate(WHOAMI_PROBE);
if (probe?.kind === 'auth') throw new AuthRequiredError('gitee.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Gitee /api/v5/user`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Gitee whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Gitee probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, username: probe.username, name: probe.name };
}
registerSiteAuthCommands({
site: 'gitee',
domain: 'gitee.com',
loginUrl: 'https://gitee.com/login',
columns: ['user_id', 'username', 'name'],
verify: verifyGiteeIdentity,
poll: async (page) => {
const probe = await page.evaluate(WHOAMI_PROBE);
if (!probe?.ok) throw new AuthRequiredError('gitee.com', 'Waiting for Gitee login');
return { user_id: probe.user_id, username: probe.username, name: probe.name };
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the page is actually on https://gitee.com/ when the probe runs (page.goto may have failed or been redirected).
- Check basic network connectivity from the machine running the browser.
- Disable extensions/content blockers in the automated browser profile.
- Re-run the command; the detail text identifies the underlying browser-side fetch error.
Example fix
// before — navigating without checking where we ended up
await page.goto('https://gitee.com/');
const identity = await verifyGiteeIdentity(page);
// after — assert origin before probing
await page.goto('https://gitee.com/', { waitUntil: 'domcontentloaded' });
if (!String(page.url()).includes('gitee.com')) throw new Error('Navigation to gitee.com failed');
const identity = await verifyGiteeIdentity(page); Defensive patterns
Strategy: retry
Validate before calling
if (!navigator.onLine) throw new Error('No network connection — cannot probe Gitee identity'); Type guard
function isProbeFailure(e) { return e instanceof Error && e.message.startsWith('Gitee whoami failed:'); } Try / catch
try {
const identity = await verifyGiteeIdentity(page);
} catch (err) {
if (err.message.startsWith('Gitee whoami failed:')) {
// network-level fetch failure: check connectivity/page origin, then retry
} else throw err;
} Prevention
- Ensure page.goto('https://gitee.com/') succeeded before probing (check the final URL).
- Run the probe only on the gitee.com origin so the relative fetch resolves.
- Disable script-blocking extensions in the automation profile.
- Add a small settle delay after navigation before evaluating the probe.
When it happens
Trigger: page.evaluate of WHOAMI_PROBE runs while the page is on a non-gitee.com origin (fetch to '/api/v5/user' fails or is blocked), the network connection drops mid-request, the request is blocked by CSP/extension, or the page navigates/closes before the async probe resolves.
Common situations: Offline or flaky network; the automated browser sitting on an error/blank page instead of gitee.com; an extension or content-blocking tool killing the fetch; the browser tab being closed during the login poll.
Related errors
- Manus whoami failed: ${probe.detail}
- Barchart greeks request failed: ${data.message || 'unknown e
- Failed to load Booking.com search page: ${err?.message || er
- Failed to open Chess.com analysis board: ${error?.message ||
- Failed to send message
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ce1caa336b19c8e7.
Report an issue: GitHub.