jackwener/OpenCLI · error · Error

Missing component input. Pass a full Uiverse URL or an autho

Error message

Missing component input. Pass a full Uiverse URL or an author/slug identifier.

What it means

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.

Source

Thrown at clis/uiverse/_shared.js:18

import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import * as path from 'node:path';

export const UIVERSE_BASE_URL = 'https://uiverse.io';

const ROUTE_DATA_KEY = 'routes/$username.$friendlyId';
const CODE_DATA_KEY = 'routes/resource.post.code.$id';
const EXPORT_TARGET_BUTTON_LABELS = ['React', 'Vue', 'Svelte', 'Lit'];

function trimPathSegment(value) {
  return String(value || '').trim().replace(/^\/+|\/+$/g, '');
}

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;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a valid uiverse.io component URL, e.g. https://uiverse.io/author/slug
  2. Pass an author/slug identifier, e.g. 'admin/dashboard-toggle'
  3. If sourcing from an env var or config, verify it is set: echo "$COMPONENT" before invoking the CLI
  4. Check the CLI invocation includes the positional argument (no missing quotes/flags consuming it)

Example fix

// before
await getPostDetails(page, process.env.COMPONENT); // COMPONENT unset -> undefined
// after
const input = process.env.COMPONENT;
if (!input?.trim()) throw new Error('Set COMPONENT to a uiverse.io URL or author/slug');
await getPostDetails(page, input);
Defensive patterns

Strategy: validation

Validate before calling

function assertComponentInput(input) {
  if (typeof input !== 'string' || !input.trim()) {
    throw new Error('component input required: uiverse.io URL or author/slug');
  }
}
assertComponentInput(input);

Type guard

const hasComponentInput = (v) => typeof v === 'string' && v.trim().length > 0;

Try / catch

try {
  const details = await getPostDetails(page, input);
} catch (e) {
  if (e.message.includes('Missing component input')) {
    console.error('Usage: cli <author/slug or uiverse.io URL>');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/932f9c5a6f42cb3f. Report an issue: GitHub.