{"record":{"id":"dc6a03b16c82d910","repo":"jackwener/OpenCLI","slug":"linkedin-inbox","errorCode":null,"errorMessage":"linkedin inbox","messagePattern":"linkedin inbox","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/linkedin/inbox.js","lineNumber":210,"sourceCode":"    // 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);\n    }\n    if (!fetched || fetched.error || !fetched.json) {\n      throw new CommandExecutionError(\n        'LinkedIn messaging API returned an unexpected response: ' + ((fetched && fetched.error) || 'no data'),\n      );\n    }\n\n    let conversations = parseConversations(fetched.json, located.mailboxUrn || '');\n    if (unreadOnly) conversations = conversations.filter((c) => c.unread);\n    if (conversations.length === 0) {\n      if (unreadOnly) return [];\n      throw new EmptyResultError('linkedin inbox', 'No LinkedIn conversations were found in the inbox.');\n    }\n\n    return conversations.slice(0, limit).map((c, index) => ({\n      rank: index + 1,\n      thread_url: threadUrl(c.thread_id),\n      thread_id: c.thread_id,\n      person_name: c.person_name,\n      last_message_preview: c.last_message_preview,\n      unread: c.unread,\n      counterparty_type: c.counterparty_type,\n      category: c.category,\n      timestamp: c.timestamp,\n    }));\n  },\n});\n\nexport const __test__ = {\n  parseConversations,","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/inbox.js#L192-L228","documentation":"After parsing and optionally filtering to unread conversations, if the inbox contains zero conversations the CLI throws an EmptyResultError keyed on the command name 'linkedin inbox'. The library treats an empty result as a distinct, catchable condition rather than returning []. Note: when --unread-only is set and nothing is unread, it returns [] instead of throwing.","triggerScenarios":"Calling `linkedin inbox` (without --unread-only) when parseConversations() yields no conversations from the fetched JSON — a genuinely empty inbox, or a parse that matched nothing due to a payload shape change.","commonSituations":"Brand-new LinkedIn account with no messages, all conversations archived/deleted, messages filtered to a folder the API query doesn't cover, or a LinkedIn API change making the parser silently return [] .","solutions":["Confirm the inbox actually has conversations by checking linkedin.com/messaging in the browser.","Drop --unread-only if you expected unread items but none exist (that path returns [] without error).","If conversations exist on the site but the error persists, the parser may no longer match LinkedIn's payload — update/report the library.","Catch EmptyResultError explicitly and treat it as an empty inbox in your automation."],"exampleFix":"// before\nconst convos = inbox(); // throws EmptyResultError on empty inbox\n\n// after\nlet convos;\ntry { convos = inbox(); }\ncatch (e) {\n  if (e instanceof EmptyResultError) convos = [];\n  else throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isEmptyResultError = (e) => e instanceof EmptyResultError && e.command === 'linkedin inbox';","tryCatchPattern":"let conversations;\ntry {\n  conversations = await linkedinInbox(opts);\n} catch (e) {\n  if (e instanceof EmptyResultError) conversations = [];\n  else throw e;\n}","preventionTips":["Catch EmptyResultError and normalize to [] in pipelines that expect possibly-empty inputs.","Prefer --unread-only when you only want unread items — that path returns [] instead of throwing.","Verify on linkedin.com/messaging that the inbox truly has conversations before assuming a parsing bug.","If the site shows messages but the CLI errors empty, suspect a parser/selector change and update the library."],"tags":["empty-result","linkedin","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}