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

  1. Verify the account actually has connections at linkedin.com/mynetwork/invite-connect/connections/.
  2. Use an account with connections, or treat this as a legitimate empty result and handle EmptyResultError gracefully.
  3. If connections exist on the site but not via CLI, update/re-login — a shadow-banned or filtered session may return empty pages.
  4. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/bf18ebfc3db79a7f. Report an issue: GitHub.