{"record":{"id":"30d1113089a17abd","repo":"jackwener/OpenCLI","slug":"linkedin-learning-courses-lookup-failed-result","errorCode":null,"errorMessage":"LinkedIn Learning courses lookup failed: ${result?.error ?? 'no payload'}","messagePattern":"LinkedIn Learning courses lookup failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin-learning/course.js","lineNumber":77,"sourceCode":"    site: 'linkedin-learning',\n    name: 'course',\n    access: 'read',\n    description: 'Get LinkedIn Learning course detail by slug or course URL',\n    domain: DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    args: [\n        { name: 'slug', type: 'string', required: true, positional: true, help: 'Course slug (e.g. agentic-ai-build-your-first-agentic-ai-system) or full /learning/<slug> URL' },\n    ],\n    columns: ['title', 'slug', 'description', 'difficulty', 'duration_sec', 'videos_count', 'rating', 'rating_count', 'released', 'url'],\n    func: async (page, args) => {\n        if (!page) throw new CommandExecutionError('Browser session required for linkedin-learning course');\n        const slug = parseSlug(args.slug);\n\n        const url = `https://www.linkedin.com/learning-api/courses?q=slug&slug=${encodeURIComponent(slug)}`;\n        const result = await fetchLinkedInLearningApi(page, url);\n        if (!result?.json) {\n            throw new CommandExecutionError(`LinkedIn Learning courses lookup failed: ${result?.error ?? 'no payload'}`);\n        }\n        const elements = result.json?.elements;\n        if (!Array.isArray(elements)) {\n            throw new CommandExecutionError('LinkedIn Learning courses lookup returned malformed payload: missing elements array');\n        }\n        const el = elements[0];\n        if (!el) {\n            throw new EmptyResultError(`No LinkedIn Learning course found for slug \"${slug}\"`);\n        }\n        const row = parseCourse(el, slug);\n        if (!row) {\n            throw new CommandExecutionError('LinkedIn Learning courses lookup returned malformed course detail: missing title');\n        }\n        return [row];\n    },\n});\n\nexport const __test__ = { parseSlug, parseCourse };","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin-learning/course.js#L59-L95","documentation":"After navigating to https://www.linkedin.com/learning-api/courses?q=slug&slug=<slug> inside the browser session, fetchLinkedInLearningApi returned no JSON payload (result.json falsy). The library wraps the underlying cause (result.error, or 'no payload') in a CommandExecutionError. Typical causes are auth/redirect to login, LinkedIn challenge pages, network errors, or the API returning non-JSON HTML.","triggerScenarios":"Calling linkedin-learning course with a page whose cookies are missing/expired, a logged-out session, a rate-limit or challenge response, or any fetch/navigation failure inside fetchLinkedInLearningApi so that result.json is undefined.","commonSituations":"Expired LinkedIn session cookies; logged-out or guest browser profile; LinkedIn serving the login wall or an anti-bot challenge; transient network/SSL failures; LinkedIn API shape or auth changes.","solutions":["Re-authenticate: refresh the LinkedIn session cookies / log in again in the browser session and retry.","Read the embedded cause (result.error) in the message and fix that specific issue (e.g. challenge -> solve the check, network -> retry).","Retry after a delay — rate limiting and transient network failures are common causes of an empty payload.","Verify the request works in a normal logged-in browser at the same learning-api URL to rule out an API-side change."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-check session health before the call:\nconst who = await fetchLinkedInLearningApi(page, 'https://www.linkedin.com/learning-api/me');\nif (!who?.json) throw new Error('LinkedIn session invalid — re-login before course lookup');","typeGuard":"function hasPayload(result) { return result != null && typeof result === 'object' && result.json != null; }","tryCatchPattern":"try {\n  await runCommand('linkedin-learning', 'course', [slug]);\n} catch (e) {\n  if (/courses lookup failed/.test(e.message)) {\n    await refreshSessionOrBackoff(e.message); // includes embedded cause in message\n  } else throw e;\n}","preventionTips":["Keep LinkedIn cookies fresh; re-login when sessions expire.","Add exponential backoff for transient network failures and rate limits.","Solve any LinkedIn challenge/checkpoint in the browser session before running bulk lookups.","Watch for LinkedIn API auth changes; test the learning-api URL manually in a logged-in browser."],"tags":["network","authentication","api-response","linkedin-learning"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}