{"record":{"id":"f6345944849e2cc7","repo":"jackwener/OpenCLI","slug":"no-pending-sent-invitations-were-found","errorCode":null,"errorMessage":"No pending sent invitations were found.","messagePattern":"No pending sent invitations were found\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/linkedin/sent-invitations.js","lineNumber":110,"sourceCode":"    await page.goto(SENT_URL);\n    await page.wait(12);\n    let result = unwrapEvaluateResult(await page.evaluate(buildSentInvitationsScript()));\n    if (result?.authRequired) {\n      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn sent invitations requires an active signed-in browser session.');\n    }\n    if (result?.warning) {\n      throw new CommandExecutionError('LinkedIn warning/restriction state visible on sent invitations page.');\n    }\n    if (!result || typeof result !== 'object' || Array.isArray(result) || !Array.isArray(result.rows)) {\n      throw new CommandExecutionError('LinkedIn sent invitations returned a malformed extraction payload.');\n    }\n    if (result.malformedCount > 0) {\n      throw new CommandExecutionError('LinkedIn sent invitations contained a malformed invitation card.');\n    }\n    const rows = result.rows;\n    if (rows.length === 0) {\n      if (result.explicitEmpty) {\n        throw new EmptyResultError('linkedin sent-invitations', 'No pending sent invitations were found.');\n      }\n      throw new CommandExecutionError('LinkedIn sent invitation cards were not found; the page structure may have changed.');\n    }\n    return rows.map((row, index) => ({\n      rank: index + 1,\n      name: row.name || '',\n      profile_url: row.profile_url || '',\n      invited_date_text: row.invited_date_text || '',\n    }));\n  },\n});\n\nexport const __test__ = {\n  buildSentInvitationsScript,\n};\n","sourceCodeStart":92,"sourceCodeEnd":126,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/sent-invitations.js#L92-L126","documentation":"The linkedin sent-invitations command scrapes the page of sent (pending) connection invitations. When the page renders its empty-state (explicitEmpty), meaning LinkedIn itself confirmed there are no pending sent invitations, the command throws EmptyResultError with this message instead of returning zero rows. It signals a legitimate empty result, not a scraping failure.","triggerScenarios":"Running `linkedin sent-invitations` while the authenticated account has zero pending sent invitations; result.rows is empty and result.explicitEmpty is true because the scraper detected LinkedIn's empty-state UI.","commonSituations":"A fresh account that has not invited anyone; all previously sent invitations were accepted, withdrawn, or expired; automation ran right after withdrawing invitations in bulk.","solutions":["Treat this as an expected empty result: catch EmptyResultError and return an empty dataset instead of alerting.","Verify on linkedin.com/mynetwork/invitation-manager/sent/ that there really are no pending invitations.","If invitations should exist, re-authenticate the browser session and re-run to rule out a stale page."],"exampleFix":"// before\ntry {\n  const rows = await runCommand('linkedin sent-invitations');\n} catch (e) {\n  console.error(e.message);\n}\n// after\nimport { EmptyResultError } from '@jackwener/opencli/errors';\ntry {\n  const rows = await runCommand('linkedin sent-invitations');\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    const rows = [];\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"const pending = await getPendingInvitationCount(); // from your own state or cache\nif (pending === 0) return []; // skip the call entirely","typeGuard":"function isEmptyResultError(e) { return e && e.name === 'EmptyResultError'; }","tryCatchPattern":"try {\n  rows = await runCommand('linkedin sent-invitations');\n} catch (e) {\n  if (isEmptyResultError(e)) rows = [];\n  else throw e;\n}","preventionTips":["Treat EmptyResultError as data, not failure — branch on the error class name.","Track invitation state locally to avoid scraping when nothing is pending.","Only alert on CommandExecutionError (structure issues), not EmptyResultError."],"tags":["linkedin","empty-result","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}