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

  1. Retry after a delay (429/5xx are typically transient).
  2. Re-authenticate in the browser if the session appears stale.
  3. Inspect result.error in the message for the HTTP status and act accordingly (backoff for 429).
  4. Update the CLI if LinkedIn changed the feedRecommendationGroups endpoint.
  5. 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

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


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