jackwener/OpenCLI · warning · EmptyResultError
linkedin connections
Error message
linkedin connections
What it means
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.
Source
Thrown at clis/linkedin/connections.js:120
throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn connections API authentication failed: ' + fetched.error);
}
if (!fetched || fetched.error || !fetched.json) {
throw new CommandExecutionError('LinkedIn connections API returned an unexpected response: ' + ((fetched && fetched.error) || 'no data'));
}
const elements = fetched.json.elements;
if (!Array.isArray(elements)) {
throw new CommandExecutionError('LinkedIn connections API returned a malformed payload: missing elements array');
}
if (elements.length === 0) break;
for (const element of elements) {
rows.push(mapConnection(element, rows.length));
if (rows.length >= limit) break;
}
start += elements.length;
if (elements.length < count) break;
}
if (rows.length === 0) {
throw new EmptyResultError('linkedin connections', 'No LinkedIn connections were found.');
}
return rows;
},
});
export const __test__ = { fetchConnections, mapConnection };
View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before
$ opencli linkedin connections
EmptyResultError: linkedin connections — No LinkedIn connections were found.
// after
try {
await opencli.linkedin.connections({ limit: 20 });
} catch (e) {
if (e.name === 'EmptyResultError') return []; // account genuinely has no connections
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Check the account actually has connections before treating emptiness as failure.
const count = (await opencli.linkedin.connections({ limit: 1 })).length;
if (count === 0) console.info('Account may have no first-degree connections.'); Type guard
function isEmptyResultError(e) {
return e && e.name === 'EmptyResultError';
} Try / catch
try {
const rows = await opencli.linkedin.connections({ limit: 20 });
} catch (e) {
if (e.name === 'EmptyResultError') return []; // legitimate empty state
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Brand-new LinkedIn account with no contacts; querying while LinkedIn still provisions a new account; a test/seed account with zero connections.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- linkedin inbox
- No trains found from ${fromStation.name} to ${toStation.name
- NO_DATA
- No Wayback snapshots for "${target}".
- Chess.com has no game archives for ${username}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bf18ebfc3db79a7f.
Report an issue: GitHub.