jackwener/OpenCLI · warning · EmptyResultError
No LinkedIn Learning course found for slug "${slug}"
Error message
No LinkedIn Learning course found for slug "${slug}" What it means
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.
Source
Thrown at clis/linkedin-learning/course.js:85
{ 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' },
],
columns: ['title', 'slug', 'description', 'difficulty', 'duration_sec', 'videos_count', 'rating', 'rating_count', 'released', 'url'],
func: async (page, args) => {
if (!page) throw new CommandExecutionError('Browser session required for linkedin-learning course');
const slug = parseSlug(args.slug);
const url = `https://www.linkedin.com/learning-api/courses?q=slug&slug=${encodeURIComponent(slug)}`;
const result = await fetchLinkedInLearningApi(page, url);
if (!result?.json) {
throw new CommandExecutionError(`LinkedIn Learning courses lookup failed: ${result?.error ?? 'no payload'}`);
}
const elements = result.json?.elements;
if (!Array.isArray(elements)) {
throw new CommandExecutionError('LinkedIn Learning courses lookup returned malformed payload: missing elements array');
}
const el = elements[0];
if (!el) {
throw new EmptyResultError(`No LinkedIn Learning course found for slug "${slug}"`);
}
const row = parseCourse(el, slug);
if (!row) {
throw new CommandExecutionError('LinkedIn Learning courses lookup returned malformed course detail: missing title');
}
return [row];
},
});
export const __test__ = { parseSlug, parseCourse };
View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before opencli linkedin-learning course 'agentic-ai-build-your-first-agentik-ai-system' // typo // after opencli linkedin-learning course 'agentic-ai-build-your-first-agentic-ai-system'
Defensive patterns
Strategy: fallback
Validate before calling
// Validate the slug exists by opening its public URL first (optional):
const res = await fetch(`https://www.linkedin.com/learning/${slug}/`, { method: 'HEAD' });
if (res.status === 404) console.warn(`Slug "${slug}" may not exist`); Type guard
function isPlausibleSlug(v) {
return typeof v === 'string' && /^[a-zA-Z0-9-_]{3,}$/.test(v);
} Try / catch
try {
return await runCommand('linkedin-learning', 'course', [slug]);
} catch (e) {
if (e instanceof EmptyResultError || e.message.startsWith('No LinkedIn Learning course found')) {
return runCommand('linkedin-learning', 'search', [slugToKeywords(slug)]); // fallback to search
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- bilibili creator-stats ${bvid}
- Chess.com returned 404 for ${url}
- crates crate
- crates.io returned 404 for ${url}.
- Photo ID ${requestedPhotoId} was not found under subject ${s
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ea7b5ce356e230ea.
Report an issue: GitHub.