jackwener/OpenCLI · error · CommandExecutionError
LinkedIn whoami failed: ${result.detail}
Error message
LinkedIn whoami failed: ${result.detail} What it means
The in-page whoami probe threw a JavaScript exception inside the browser context; the probe caught it and returned kind:'exception', which the library rethrows as CommandExecutionError('LinkedIn whoami failed: <detail>'). This is a client-side evaluation failure, not an HTTP error from LinkedIn.
Source
Thrown at clis/linkedin/auth.js:44
const mini = d && d.miniProfile;
if (!mini || !mini.publicIdentifier) {
return { kind: 'auth', detail: 'LinkedIn /voyager/api/me 200 but miniProfile missing' };
}
const firstName = (mini.firstName && (mini.firstName.text || mini.firstName)) || '';
const lastName = (mini.lastName && (mini.lastName.text || mini.lastName)) || '';
return {
ok: true,
public_id: String(mini.publicIdentifier),
plain_id: String(d.plainId || ''),
name: String((firstName + ' ' + lastName).trim()),
};
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (result?.kind === 'auth') throw new AuthRequiredError('linkedin.com', result.detail);
if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /voyager/api/me`);
if (result?.kind === 'exception') throw new CommandExecutionError(`LinkedIn whoami failed: ${result.detail}`);
if (!result?.ok) throw new CommandExecutionError(`Unexpected LinkedIn probe: ${JSON.stringify(result)}`);
return { public_id: result.public_id, plain_id: result.plain_id, name: result.name };
}
registerSiteAuthCommands({
site: 'linkedin',
domain: 'www.linkedin.com',
loginUrl: 'https://www.linkedin.com/login',
columns: ['public_id', 'plain_id', 'name'],
quickCheck: hasLinkedinSessionCookie,
verify: verifyLinkedinIdentity,
poll: async (page) => {
if (!await hasLinkedinSessionCookie(page)) {
throw new AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie');
}
return verifyLinkedinIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Read result.detail in the message to identify the underlying exception, then fix accordingly.
- Retry the command — transient navigation/network interruptions resolve on re-run.
- Ensure the browser stays on a linkedin.com page and doesn't navigate during verification.
- Update the headless browser runtime if the detail indicates a missing API.
Example fix
// before
await run('linkedin whoami'); // LinkedIn whoami failed: Failed to fetch
// after
await run('linkedin feed'); // ensure page loaded and network is up
await run('linkedin whoami'); // retry probe Defensive patterns
Strategy: try-catch
Validate before calling
// check basic connectivity before probing
await page.goto('https://www.linkedin.com/feed/', { waitUntil: 'domcontentloaded' }); Type guard
null
Try / catch
try {
await run('linkedin whoami');
} catch (e) {
if (/LinkedIn whoami failed:/.test(e.message)) {
await sleep(2000);
return run('linkedin whoami'); // transient in-page exception
}
throw e;
} Prevention
- Keep the automated browser on a stable linkedin.com page during probes.
- Disable browser extensions that inject scripts.
- Retry once on transient in-page exceptions.
When it happens
Trigger: The async IIFE inside page.evaluate throws — e.g. fetch itself rejected (network/CORS/aborted), or code in the try block hit an unexpected shape before the guarded return.
Common situations: Automation browser lost connectivity mid-probe; a LinkedIn extension/override altering page JS; navigation interrupting the evaluate; older browser runtime lacking APIs the probe uses.
Related errors
- 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
- coupang search filtered navigation failed: ${error?.message
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1be59276f98ae306.
Report an issue: GitHub.