{"record":{"id":"ea7b5ce356e230ea","repo":"jackwener/OpenCLI","slug":"no-linkedin-learning-course-found-for-slug-slug","errorCode":null,"errorMessage":"No LinkedIn Learning course found for slug \"${slug}\"","messagePattern":"No LinkedIn Learning course found for slug \"(.+?)\"","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/linkedin-learning/course.js","lineNumber":85,"sourceCode":"        { 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 };\n","sourceCodeStart":67,"sourceCodeEnd":96,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin-learning/course.js#L67-L96","documentation":"The API responded correctly with a well-formed elements array, but it is empty — LinkedIn has no course matching the requested slug. This is thrown as an EmptyResultError to signal 'query valid, nothing found' rather than a malfunction.","triggerScenarios":"Calling linkedin-learning course with a syntactically valid slug (passes ^[a-zA-Z0-9-_]+$) that does not correspond to an existing/published LinkedIn Learning course, so elements[0] is undefined.","commonSituations":"Typo in the slug; course retired or region-restricted (unavailable in the account's locale); slug belongs to a learning path or video rather than a course; wrong localized slug.","solutions":["Verify the slug against the course's live URL (https://www.linkedin.com/learning/<slug>/) and fix typos.","Use the linkedin-learning search command with the course title to find the current slug.","Check whether the course was retired or is region/language-restricted for your account."],"exampleFix":"// before\nopencli linkedin-learning course 'agentic-ai-build-your-first-agentik-ai-system'  // typo\n// after\nopencli linkedin-learning course 'agentic-ai-build-your-first-agentic-ai-system'","handlingStrategy":"fallback","validationCode":"// Validate the slug exists by opening its public URL first (optional):\nconst res = await fetch(`https://www.linkedin.com/learning/${slug}/`, { method: 'HEAD' });\nif (res.status === 404) console.warn(`Slug \"${slug}\" may not exist`);","typeGuard":"function isPlausibleSlug(v) {\n  return typeof v === 'string' && /^[a-zA-Z0-9-_]{3,}$/.test(v);\n}","tryCatchPattern":"try {\n  return await runCommand('linkedin-learning', 'course', [slug]);\n} catch (e) {\n  if (e instanceof EmptyResultError || e.message.startsWith('No LinkedIn Learning course found')) {\n    return runCommand('linkedin-learning', 'search', [slugToKeywords(slug)]); // fallback to search\n  }\n  throw e;\n}","preventionTips":["Copy slugs directly from the course URL; don't retype them.","Verify the course is still published and available in your region/language.","Treat empty results as 'wrong slug or retired course' and fall back to search by title."],"tags":["empty-result","not-found","linkedin-learning"],"backgroundTag":"no-results-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}