jackwener/OpenCLI · error · CommandExecutionError

Unexpected LinkedIn probe: ${JSON.stringify(result)}

Error message

Unexpected LinkedIn probe: ${JSON.stringify(result)}

What it means

Fallback assertion: the whoami probe returned something that matched none of the known kinds ('auth'/'http'/'exception') yet wasn't the expected ok payload. The library throws CommandExecutionError with the full JSON-serialized result so unexpected probe shapes are debuggable instead of silently producing undefined identity fields.

Source

Thrown at clis/linkedin/auth.js:45

      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

  1. Inspect the JSON in the error message to see the unexpected shape.
  2. Upgrade/reinstall the library so probe script and parser versions match.
  3. Re-login and retry to rule out an intermediate page state.
  4. Report the payload to the library maintainers if it reproduces.

Example fix

// before
npm ls your-cli  // mismatched patched copy of auth.js
// after
npm ci           // clean matching install of cli + probe
await run('linkedin whoami');
Defensive patterns

Strategy: type-guard

Validate before calling

null

Type guard

function isWhoamiResult(r) {
  return !!r && typeof r === 'object' &&
    (r.ok === true
      ? typeof r.public_id === 'string' && typeof r.plain_id === 'string' && typeof r.name === 'string'
      : ['auth', 'http', 'exception'].includes(r.kind));
}

Try / catch

try {
  await run('linkedin whoami');
} catch (e) {
  if (/Unexpected LinkedIn probe:/.test(e.message)) {
    console.error(e.message); // inspect payload, report to maintainers
  }
  throw e;
}

Prevention

When it happens

Trigger: verifyLinkedinIdentity receives a result whose kind is unknown or whose ok flag is falsy — e.g. a shape returned by a modified/older probe script or an unforeseen page response branch.

Common situations: Mixing library versions where the evaluate script and result handling disagree; a LinkedIn page change causing the probe to return a new unhandled kind; monkey-patched fetch in the page altering the payload.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1f02d12cb122bac5. Report an issue: GitHub.