jackwener/OpenCLI · error · Error
Could not parse author/slug from input: ${raw}
Error message
Could not parse author/slug from input: ${raw} What it means
Thrown by parseComponentInput when the input (or the pathname of a valid uiverse.io URL) does not resolve to exactly two path segments. The library strictly expects an author/slug pair; 1 segment (just an author), 3+ segments (extra path like /element/button/slug), or 0 segments all fail.
Source
Thrown at clis/uiverse/_shared.js:33
export function parseComponentInput(input) {
const raw = String(input || '').trim();
if (!raw) {
throw new Error('Missing component input. Pass a full Uiverse URL or an author/slug identifier.');
}
let pathname = raw;
if (/^https?:\/\//i.test(raw)) {
const url = new URL(raw);
if (url.hostname !== 'uiverse.io' && url.hostname !== 'www.uiverse.io') {
throw new Error(`Unsupported non-Uiverse URL: ${raw}`);
}
pathname = url.pathname;
}
const cleaned = trimPathSegment(pathname);
const segments = cleaned.split('/').filter(Boolean);
if (segments.length !== 2) {
throw new Error(`Could not parse author/slug from input: ${raw}`);
}
const [username, slug] = segments;
if (!username || !slug) {
throw new Error(`Invalid component identifier: ${raw}. Expected author/slug.`);
}
return {
raw,
username,
slug,
url: `${UIVERSE_BASE_URL}/${username}/${slug}`,
};
}
async function fetchJsonInBrowser(page, url) {
const raw = await page.evaluate(`(async () => {
const url = ${JSON.stringify(url)};View on GitHub (pinned to 49907e53dc)
Solutions
- Provide exactly author/slug, e.g. 'pravsingh/sky-button'
- Use the component's canonical page URL https://uiverse.io/<author>/<slug>, not category or element pages
- Strip extra path segments or trailing slashes/query strings from a copied URL
- If you only know the author, browse their profile to pick a specific component slug
Example fix
// before await getPostDetails(page, 'https://uiverse.io/element/checkbox'); // 2 segments but not author/slug context, or 'pravsingh' -> 1 segment // after await getPostDetails(page, 'https://uiverse.io/pravsingh/sky-button');
Defensive patterns
Strategy: validation
Validate before calling
function assertAuthorSlug(input) {
const path = input.startsWith('http') ? new URL(input).pathname : input;
const segs = path.split('/').filter(Boolean);
if (segs.length !== 2) throw new Error(`expected author/slug, got: ${input}`);
}
assertAuthorSlug(input); Type guard
const isAuthorSlug = (input) => {
const path = /^https?:\/\//i.test(input) ? new URL(input).pathname : input;
return path.split('/').filter(Boolean).length === 2;
}; Try / catch
try {
const details = await getPostDetails(page, input);
} catch (e) {
if (e.message.startsWith('Could not parse author/slug')) {
console.error(`Bad identifier '${input}'. Use uiverse.io/<author>/<slug>.`);
process.exit(2);
}
throw e;
} Prevention
- Always use the canonical component page URL, not element/category/profile pages
- Strip query strings, hashes, and trailing slashes from copied URLs
- When constructing identifiers programmatically, assert both parts are non-empty
- Keep a lookup of known-good author/slug pairs in scripts
When it happens
Trigger: Passing just the author name ('pravsingh'); passing a full URL with extra path segments (https://uiverse.io/a/b/c); passing a uiverse.io explore/element/category URL instead of a component page URL; passing a URL with query string only or a bare domain (pathname '/' -> 0 segments).
Common situations: Grabbing the wrong link off uiverse.io (an element category page like /element/checkbox instead of a component page); truncating a URL; building URLs programmatically and joining an extra segment; forgetting the slug portion of an author/slug pair.
Related errors
- Unsupported Nowcoder URL; expected /discuss/<content-id> or
- Invalid board URL: ${trimmed}
- Invalid image URL: ${imageUrl}
- Unsupported image URL protocol: ${parsed.protocol}
- Missing component input. Pass a full Uiverse URL or an autho
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/eed3df0199eccc15.
Report an issue: GitHub.