jackwener/OpenCLI · error · CommandExecutionError
LinkedIn Learning feedRecommendationGroups failed: ${result?
Error message
LinkedIn Learning feedRecommendationGroups failed: ${result?.error ?? 'no payload'} What it means
Thrown when the feedRecommendationGroups API call finishes but yields no JSON payload (result.json absent), mirroring the searchV2 case. The in-page fetch script reports the cause in result.error (HTTP status or fetch failure); 'no payload' means even the error field was missing.
Source
Thrown at clis/linkedin-learning/trending.js:46
site: 'linkedin-learning',
name: 'trending',
access: 'read',
description: 'Browse LinkedIn Learning recommended courses across personalized carousels',
domain: DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
args: [
{ name: 'limit', type: 'int', default: 10, help: `Maximum results to return (1-${MAX_LIMIT})` },
],
columns: ['rank', 'group', 'type', 'title', 'difficulty', 'viewers', 'url'],
func: async (page, args) => {
if (!page) throw new CommandExecutionError('Browser session required for linkedin-learning trending');
const limit = parseLimit(args.limit);
const url = `https://www.linkedin.com/learning-api/feedRecommendationGroups?countPerCarousel=${MAX_PER_CAROUSEL}&q=learner`;
const result = await fetchLinkedInLearningApi(page, url);
if (!result?.json) {
throw new CommandExecutionError(`LinkedIn Learning feedRecommendationGroups failed: ${result?.error ?? 'no payload'}`);
}
const groups = result.json?.elements;
if (!Array.isArray(groups)) {
throw new CommandExecutionError('LinkedIn Learning feedRecommendationGroups returned malformed payload: missing elements array');
}
const rows = [];
const seen = new Set();
let rank = 1;
let sawCards = false;
for (const group of groups) {
const carousels = Array.isArray(group?.carousels) ? group.carousels : [];
for (const carousel of carousels) {
const cards = Array.isArray(carousel?.cards) ? carousel.cards : [];
for (const card of cards) {
sawCards = true;
if (rows.length >= limit) break;
const slug = card?.slug;
if (!slug || seen.has(slug)) continue;View on GitHub (pinned to 49907e53dc)
Solutions
- Retry after a delay (429/5xx are typically transient).
- Re-authenticate in the browser if the session appears stale.
- Inspect result.error in the message for the HTTP status and act accordingly (backoff for 429).
- Update the CLI if LinkedIn changed the feedRecommendationGroups endpoint.
- Check network/proxy connectivity for the automated browser.
Example fix
// before
if (!result?.json) throw new CommandExecutionError(`feedRecommendationGroups failed: ${result?.error ?? 'no payload'}`);
// after
if (!result?.json) {
if (result?.error === 'HTTP 429') await sleep(60000);
throw new CommandExecutionError(`feedRecommendationGroups failed: ${result?.error ?? 'no payload'}`);
} Defensive patterns
Strategy: try-catch
Validate before calling
// confirm session before calling trending API
const cookies = await page.getCookies({ url: 'https://www.linkedin.com' });
if (!cookies.some(c => c.name === 'JSESSIONID')) throw new Error('Sign in to LinkedIn first'); Type guard
function hasJson(r) { return !!r && typeof r === 'object' && r.json !== null && typeof r.json === 'object'; } Try / catch
try {
const rows = await trending(page);
} catch (e) {
if (/HTTP 429/.test(e.message)) { await sleep(60000); /* back off and retry */ }
else if (/auth/i.test(e.message)) { await relogin(page); }
else throw e;
} Prevention
- Throttle trending calls to avoid LinkedIn feed-API rate limits
- Refresh the session when errors indicate stale auth
- Retry transient 5xx with exponential backoff
- Keep the CLI updated for feedRecommendationGroups endpoint changes
When it happens
Trigger: The in-page fetch throws (network error, aborted navigation) returning {error:'fetch failed: ...'}, or the endpoint responds with a non-OK status other than 401/403 (e.g. HTTP 429/500), yielding {error:'HTTP <status>'} instead of {json}.
Common situations: LinkedIn throttling the feed API for the session, transient 5xx outages, session soft-expiring with a redirect that isn't 401/403, or navigating the page away during page.evaluate.
Related errors
- LinkedIn Learning searchV2 failed: ${result?.error ?? 'no pa
- ${label} returned HTTP ${resp.status}: ${summarizeApiError(p
- HTTP ${result.httpStatus} from /api/organizations
- ${label} returned HTTP ${res.status}
- HTTP_ERROR
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/61abfb5b624d51ba.
Report an issue: GitHub.