{"record":{"id":"bf18ebfc3db79a7f","repo":"jackwener/OpenCLI","slug":"linkedin-connections","errorCode":null,"errorMessage":"linkedin connections","messagePattern":"linkedin connections","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/linkedin/connections.js","lineNumber":120,"sourceCode":"                throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn connections API authentication failed: ' + fetched.error);\n            }\n            if (!fetched || fetched.error || !fetched.json) {\n                throw new CommandExecutionError('LinkedIn connections API returned an unexpected response: ' + ((fetched && fetched.error) || 'no data'));\n            }\n            const elements = fetched.json.elements;\n            if (!Array.isArray(elements)) {\n                throw new CommandExecutionError('LinkedIn connections API returned a malformed payload: missing elements array');\n            }\n            if (elements.length === 0) break;\n            for (const element of elements) {\n                rows.push(mapConnection(element, rows.length));\n                if (rows.length >= limit) break;\n            }\n            start += elements.length;\n            if (elements.length < count) break;\n        }\n        if (rows.length === 0) {\n            throw new EmptyResultError('linkedin connections', 'No LinkedIn connections were found.');\n        }\n        return rows;\n    },\n});\n\nexport const __test__ = { fetchConnections, mapConnection };\n","sourceCodeStart":102,"sourceCodeEnd":127,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/connections.js#L102-L127","documentation":"EmptyResultError for 'linkedin connections' is thrown when the API succeeded and pagination completed but zero connections were collected. It distinguishes a valid empty state from an auth or schema failure.","triggerScenarios":"Running `linkedin connections` on an account with no first-degree connections (fresh/new account), or where every returned element was empty and the loop broke with rows.length === 0.","commonSituations":"Brand-new LinkedIn account with no contacts; querying while LinkedIn still provisions a new account; a test/seed account with zero connections.","solutions":["Verify the account actually has connections at linkedin.com/mynetwork/invite-connect/connections/.","Use an account with connections, or treat this as a legitimate empty result and handle EmptyResultError gracefully.","If connections exist on the site but not via CLI, update/re-login — a shadow-banned or filtered session may return empty pages.","Retry with a larger --limit once the account has data."],"exampleFix":"// before\n$ opencli linkedin connections\nEmptyResultError: linkedin connections — No LinkedIn connections were found.\n// after\ntry {\n  await opencli.linkedin.connections({ limit: 20 });\n} catch (e) {\n  if (e.name === 'EmptyResultError') return []; // account genuinely has no connections\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Check the account actually has connections before treating emptiness as failure.\nconst count = (await opencli.linkedin.connections({ limit: 1 })).length;\nif (count === 0) console.info('Account may have no first-degree connections.');","typeGuard":"function isEmptyResultError(e) {\n  return e && e.name === 'EmptyResultError';\n}","tryCatchPattern":"try {\n  const rows = await opencli.linkedin.connections({ limit: 20 });\n} catch (e) {\n  if (e.name === 'EmptyResultError') return []; // legitimate empty state\n  throw e;\n}","preventionTips":["Treat EmptyResultError as data, not failure.","Verify the account has connections in the LinkedIn UI before debugging the CLI.","For fresh accounts, wait until contacts exist before running reports."],"tags":["linkedin","empty-result","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}