jackwener/OpenCLI · error · CommandExecutionError
LinkedIn connections returned an element without a miniProfi
Error message
LinkedIn connections returned an element without a miniProfile
What it means
mapConnection() requires every element of the connections API response to carry a miniProfile object. If an element lacks miniProfile or it is not an object (LinkedIn sometimes returns shadow entities for removed/hidden members), CommandExecutionError is thrown because rank/name/public_id cannot be derived.
Source
Thrown at clis/linkedin/connections.js:54
return { error: 'response was not valid JSON' };
}
} catch (e) {
return { error: 'fetch failed: ' + ((e && e.message) || String(e)) };
}
}
function optionalText(value, field) {
if (value == null) return '';
if (typeof value !== 'string') {
throw new CommandExecutionError(`LinkedIn connection miniProfile field ${field} was malformed`);
}
return normalizeWhitespace(value);
}
function mapConnection(element, index) {
const mini = element && element.miniProfile;
if (!mini || typeof mini !== 'object') {
throw new CommandExecutionError('LinkedIn connections returned an element without a miniProfile');
}
const publicId = optionalText(mini.publicIdentifier, 'publicIdentifier');
if (!publicId || /[\s/?#]/.test(publicId)) {
throw new CommandExecutionError('LinkedIn connection element missing a stable public identifier');
}
const name = normalizeWhitespace([
optionalText(mini.firstName, 'firstName'),
optionalText(mini.lastName, 'lastName'),
].filter(Boolean).join(' ')) || publicId;
return {
rank: index + 1,
name,
occupation: optionalText(mini.occupation, 'occupation'),
public_id: publicId,
connected_at: Number.isFinite(element.createdAt) ? element.createdAt : 0,
url: publicId ? `https://www.linkedin.com/in/${encodeURIComponent(publicId)}` : '',
};
}View on GitHub (pinned to 49907e53dc)
Solutions
- Update the CLI to a version that skips elements without miniProfile instead of throwing.
- Retry with a smaller limit to isolate which page contains the bad element.
- Locally patch mapConnection to `if (!mini || typeof mini !== 'object') return null;` and filter nulls from rows.
- Report the occurrence to the library maintainers with the approximate total connection count.
Example fix
// before
if (!mini || typeof mini !== 'object') {
throw new CommandExecutionError('LinkedIn connections returned an element without a miniProfile');
}
// after
if (!mini || typeof mini !== 'object') return null; // filtered later: elements.map(mapConnection).filter(Boolean) Defensive patterns
Strategy: type-guard
Validate before calling
// Guard at consumption time
const connections = (await opencli.linkedin.connections({ limit: 20 }))
.filter(r => r && r.public_id); Type guard
function hasMiniProfile(element) {
return Boolean(element && typeof element === 'object' && element.miniProfile && typeof element.miniProfile === 'object');
} Try / catch
try {
const rows = await opencli.linkedin.connections({ limit: 20 });
} catch (e) {
if (/without a miniProfile/.test(e.message || '')) {
console.warn('A connection element lacked miniProfile (restricted/deleted member); retrying with smaller limit.');
return opencli.linkedin.connections({ limit: 10 });
}
throw e;
} Prevention
- Prefer smaller pagination limits so one bad element costs less.
- Keep the CLI updated for tolerant element-skipping behavior.
- Expect occasional null miniProfile for deactivated accounts; handle empty rows defensively.
When it happens
Trigger: Running `linkedin connections` when a page of the Voyager response contains an element whose miniProfile is null/undefined — typically for deactivated, restricted, or hidden-from-list connections.
Common situations: A connection deleted or restricted their account; LinkedIn filtering a member from public view while still listing the relationship; API contract drift adding new element types.
Related errors
- LinkedIn connection miniProfile field ${field} was malformed
- LinkedIn connection element missing a stable public identifi
- LinkedIn connections API returned a malformed payload: missi
- LinkedIn messaging API returned malformed normalized payload
- LinkedIn messaging API returned a conversation without threa
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/53a250a437440970.
Report an issue: GitHub.