{"record":{"id":"1f02d12cb122bac5","repo":"jackwener/OpenCLI","slug":"unexpected-linkedin-probe-json-stringify-result","errorCode":null,"errorMessage":"Unexpected LinkedIn probe: ${JSON.stringify(result)}","messagePattern":"Unexpected LinkedIn probe: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/auth.js","lineNumber":45,"sourceCode":"      if (!mini || !mini.publicIdentifier) {\n        return { kind: 'auth', detail: 'LinkedIn /voyager/api/me 200 but miniProfile missing' };\n      }\n      const firstName = (mini.firstName && (mini.firstName.text || mini.firstName)) || '';\n      const lastName = (mini.lastName && (mini.lastName.text || mini.lastName)) || '';\n      return {\n        ok: true,\n        public_id: String(mini.publicIdentifier),\n        plain_id: String(d.plainId || ''),\n        name: String((firstName + ' ' + lastName).trim()),\n      };\n    } catch (e) {\n      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (result?.kind === 'auth') throw new AuthRequiredError('linkedin.com', result.detail);\n  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /voyager/api/me`);\n  if (result?.kind === 'exception') throw new CommandExecutionError(`LinkedIn whoami failed: ${result.detail}`);\n  if (!result?.ok) throw new CommandExecutionError(`Unexpected LinkedIn probe: ${JSON.stringify(result)}`);\n  return { public_id: result.public_id, plain_id: result.plain_id, name: result.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'linkedin',\n  domain: 'www.linkedin.com',\n  loginUrl: 'https://www.linkedin.com/login',\n  columns: ['public_id', 'plain_id', 'name'],\n  quickCheck: hasLinkedinSessionCookie,\n  verify: verifyLinkedinIdentity,\n  poll: async (page) => {\n    if (!await hasLinkedinSessionCookie(page)) {\n      throw new AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie');\n    }\n    return verifyLinkedinIdentity(page);\n  },\n});\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/auth.js#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the JSON in the error message to see the unexpected shape.","Upgrade/reinstall the library so probe script and parser versions match.","Re-login and retry to rule out an intermediate page state.","Report the payload to the library maintainers if it reproduces."],"exampleFix":"// before\nnpm ls your-cli  // mismatched patched copy of auth.js\n// after\nnpm ci           // clean matching install of cli + probe\nawait run('linkedin whoami');","handlingStrategy":"type-guard","validationCode":"null","typeGuard":"function isWhoamiResult(r) {\n  return !!r && typeof r === 'object' &&\n    (r.ok === true\n      ? typeof r.public_id === 'string' && typeof r.plain_id === 'string' && typeof r.name === 'string'\n      : ['auth', 'http', 'exception'].includes(r.kind));\n}","tryCatchPattern":"try {\n  await run('linkedin whoami');\n} catch (e) {\n  if (/Unexpected LinkedIn probe:/.test(e.message)) {\n    console.error(e.message); // inspect payload, report to maintainers\n  }\n  throw e;\n}","preventionTips":["Use a clean install so evaluate script and handler versions match.","Log the serialized payload from the error for debugging.","Re-login to rule out intermediate page states."],"tags":["unexpected-response","version-mismatch","voyager-api"],"backgroundTag":"unexpected-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}