{"record":{"id":"e4d84d8b7daf8668","repo":"jackwener/OpenCLI","slug":"linkedin-did-not-issue-a-messaging-api-request-th","errorCode":null,"errorMessage":"LinkedIn did not issue a messaging API request; the inbox may have failed to load.","messagePattern":"LinkedIn did not issue a messaging API request; the inbox may have failed to load\\.","errorType":"error_code","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/inbox.js","lineNumber":180,"sourceCode":"      }\n    }\n    const unreadOnly = Boolean(kwargs['unread-only']);\n\n    await page.goto(MESSAGING_URL);\n    await page.wait(10);\n\n    // Locate the messaging API request the page fired on load; retry once if the\n    // SPA was slow to issue it.\n    let located = unwrapEvaluateResult(await page.evaluate(`(${findMessagingApiUrl.toString()})()`));\n    if (located && located.loginRequired) {\n      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn requires an active signed-in browser session.');\n    }\n    if (!located || !located.url) {\n      await page.wait(6);\n      located = unwrapEvaluateResult(await page.evaluate(`(${findMessagingApiUrl.toString()})()`));\n    }\n    if (!located || !located.url) {\n      throw new CommandExecutionError(\n        'LinkedIn did not issue a messaging API request; the inbox may have failed to load.',\n      );\n    }\n\n    const cookies = await page.getCookies({ url: 'https://www.linkedin.com' });\n    const jsession = cookies.find((c) => c.name === 'JSESSIONID')?.value;\n    if (!jsession) {\n      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn JSESSIONID cookie not found. Please sign in to LinkedIn.');\n    }\n    const csrf = jsession.replace(/^\"|\"$/g, '');\n\n    // Widen the page size to the requested limit where the query supports it.\n    const targetUrl = located.url.replace(/count:\\d+/, 'count:' + limit);\n    const fetched = unwrapEvaluateResult(\n      await page.evaluate(`(${fetchMessagingApi.toString()})(${JSON.stringify(targetUrl)}, ${JSON.stringify(csrf)})`),\n    );\n    if (fetched && fetched.authRequired) {\n      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn messaging API authentication failed: ' + fetched.error);","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/inbox.js#L162-L198","documentation":"The CLI waits for the messaging page to fire its internal messaging API request and captures the URL. If after the initial check and one retry (extra 6-unit wait) no API request URL can be located, it concludes the inbox SPA failed to load and throws a CommandExecutionError. This is a page-load/network-level failure, not an auth failure.","triggerScenarios":"findMessagingApiUrl() returns nothing usable on both attempts: LinkedIn served an error page, the SPA JS crashed or was slow, network blocked voyager/messaging endpoints, or an A/B layout changed the request pattern.","commonSituations":"Slow corporate proxy or ad-blocker stripping API calls, LinkedIn outage or 5xx page, very slow machine where even the retry wait is insufficient, or LinkedIn DOM/network changes breaking the detection script.","solutions":["Re-run the command; transient SPA slowness or a slow network is the most common cause.","Disable ad-blockers/proxy interference for linkedin.com in the automated browser profile.","Check linkedin.com messaging loads manually in the same profile; if LinkedIn itself errors, wait and retry.","If it persists after LinkedIn works manually, the detection script may need updating for a LinkedIn layout/API change — report/update the library."],"exampleFix":"// before\nawait cli.inbox(); // CommandExecutionError on flaky network\n\n// after\nawait retry(() => cli.inbox(), { attempts: 3, backoff: 'exponential' });","handlingStrategy":"retry","validationCode":"async function messagingReachable() {\n  try { const r = await fetch('https://www.linkedin.com/messaging/'); return r.ok || r.status < 500; }\n  catch { return false; }\n}","typeGuard":"const isApiRequestMissing = (e) => e instanceof CommandExecutionError && /did not issue .* API request/i.test(e?.message || '');","tryCatchPattern":"try {\n  return await linkedinInbox();\n} catch (e) {\n  if (isApiRequestMissing(e)) {\n    await sleep(5000);\n    return retry(linkedinInbox, { attempts: 3, backoff: (n) => 2 ** n * 1000 });\n  }\n  throw e;\n}","preventionTips":["Exclude linkedin.com from ad-blockers/privacy extensions in the automated profile.","Run on a stable network; avoid parallel LinkedIn commands that could trip throttling.","Add generous pre-waits or wait-for-network-idle before page evaluation in custom flows.","Pin and update the library when LinkedIn changes its SPA request patterns."],"tags":["network","spa","linkedin","scraping"],"backgroundTag":"api-request-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}