{"record":{"id":"932f9c5a6f42cb3f","repo":"jackwener/OpenCLI","slug":"missing-component-input-pass-a-full-uiverse-url-o","errorCode":null,"errorMessage":"Missing component input. Pass a full Uiverse URL or an author/slug identifier.","messagePattern":"Missing component input\\. Pass a full Uiverse URL or an author/slug identifier\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/uiverse/_shared.js","lineNumber":18,"sourceCode":"import * as fs from 'node:fs/promises';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\nexport const UIVERSE_BASE_URL = 'https://uiverse.io';\n\nconst ROUTE_DATA_KEY = 'routes/$username.$friendlyId';\nconst CODE_DATA_KEY = 'routes/resource.post.code.$id';\nconst EXPORT_TARGET_BUTTON_LABELS = ['React', 'Vue', 'Svelte', 'Lit'];\n\nfunction trimPathSegment(value) {\n  return String(value || '').trim().replace(/^\\/+|\\/+$/g, '');\n}\n\nexport function parseComponentInput(input) {\n  const raw = String(input || '').trim();\n  if (!raw) {\n    throw new Error('Missing component input. Pass a full Uiverse URL or an author/slug identifier.');\n  }\n\n  let pathname = raw;\n  if (/^https?:\\/\\//i.test(raw)) {\n    const url = new URL(raw);\n    if (url.hostname !== 'uiverse.io' && url.hostname !== 'www.uiverse.io') {\n      throw new Error(`Unsupported non-Uiverse URL: ${raw}`);\n    }\n    pathname = url.pathname;\n  }\n\n  const cleaned = trimPathSegment(pathname);\n  const segments = cleaned.split('/').filter(Boolean);\n  if (segments.length !== 2) {\n    throw new Error(`Could not parse author/slug from input: ${raw}`);\n  }\n\n  const [username, slug] = segments;","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/uiverse/_shared.js#L1-L36","documentation":"Thrown by parseComponentInput in clis/uiverse/_shared.js when the component identifier argument is empty, undefined, or null after trimming. The library requires either a full uiverse.io URL or an 'author/slug' string to identify the component; with no input it cannot build the component page URL.","triggerScenarios":"Calling getPostDetails(page, input) (or any CLI command that funnels through parseComponentInput) with an empty string, whitespace, undefined, or null as the component argument; a missing CLI positional argument so input arrives as undefined; passing an env var or config value that is unset.","commonSituations":"Running the CLI command without the component argument; shell variables like $COMPONENT expanding to empty in scripts; reading the component id from a config file or CI secret that is not set; forgetting to quote a value that the shell swallowed.","solutions":["Pass a valid uiverse.io component URL, e.g. https://uiverse.io/author/slug","Pass an author/slug identifier, e.g. 'admin/dashboard-toggle'","If sourcing from an env var or config, verify it is set: echo \"$COMPONENT\" before invoking the CLI","Check the CLI invocation includes the positional argument (no missing quotes/flags consuming it)"],"exampleFix":"// before\nawait getPostDetails(page, process.env.COMPONENT); // COMPONENT unset -> undefined\n// after\nconst input = process.env.COMPONENT;\nif (!input?.trim()) throw new Error('Set COMPONENT to a uiverse.io URL or author/slug');\nawait getPostDetails(page, input);","handlingStrategy":"validation","validationCode":"function assertComponentInput(input) {\n  if (typeof input !== 'string' || !input.trim()) {\n    throw new Error('component input required: uiverse.io URL or author/slug');\n  }\n}\nassertComponentInput(input);","typeGuard":"const hasComponentInput = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n  const details = await getPostDetails(page, input);\n} catch (e) {\n  if (e.message.includes('Missing component input')) {\n    console.error('Usage: cli <author/slug or uiverse.io URL>');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Always pass the identifier explicitly; never rely on possibly-empty env vars without a fallback/default","Add a CLI-level required-argument check before calling the library","Trim and log the resolved input value in scripts before invocation","Validate config-file sourced values at startup"],"tags":["input-validation","argument-parsing","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}