jackwener/OpenCLI · error · ArgumentError

designer is required (for example: halolab)

Error message

designer is required (for example: halolab)

What it means

requireDesigner validates the Dribbble designer argument before any scraping command runs. It throws this ArgumentError when the value is missing, empty, or only whitespace after String coercion and trim. The library refuses to proceed without a designer slug because every designer-based lookup URL depends on it.

Source

Thrown at clis/dribbble/utils.js:41

    return limit;
}

export function requireQuery(value, label = 'query') {
    const query = String(value ?? '').trim();
    if (!query) throw new ArgumentError(`${label} is required`);
    if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);
    return query;
}

export function optionalQuery(value, label = 'query') {
    const query = String(value ?? '').trim();
    if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);
    return query;
}

export function requireDesigner(value) {
    const designer = String(value ?? '').trim();
    if (!designer) throw new ArgumentError('designer is required (for example: halolab)');
    if (!/^[A-Za-z0-9_-]{1,100}$/.test(designer)) {
        throw new ArgumentError('designer must be a Dribbble username or profile slug');
    }
    return designer;
}

export function requireShotTarget(value) {
    const target = String(value ?? '').trim();
    if (!target) throw new ArgumentError('shot is required (numeric id or dribbble.com/shots URL)');
    if (/^\d+$/.test(target)) return target;

    let url;
    try {
        url = new URL(target);
    } catch {
        throw new ArgumentError('shot must be a numeric id or dribbble.com/shots URL');
    }
    if (!/(^|\.)dribbble\.com$/i.test(url.hostname)) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a Dribbble username or profile slug (e.g. 'halolab') to the command or API call.
  2. Check where the value comes from (env var, config file, CLI flag) and confirm it is set and non-blank.
  3. Trim user input before passing it so whitespace-only values become real values or are rejected earlier with a clearer message.

Example fix

// before
cli.shots({ designer: process.env.DRIBBBLE_DESIGNER }) // env var unset

// after
const designer = process.env.DRIBBBLE_DESIGNER || 'halolab';
cli.shots({ designer });
Defensive patterns

Strategy: validation

Validate before calling

const designer = typeof value === 'string' ? value.trim() : '';
if (!designer) throw new Error('designer is required before calling this command');

Type guard

function isValidDesigner(v) {
  return typeof v === 'string' && /^[A-Za-z0-9_-]{1,100}$/.test(v.trim());
}

Try / catch

try {
  const rows = command({ designer });
} catch (e) {
  if (e instanceof ArgumentError && /designer is required/.test(e.message)) {
    console.error('Missing --designer argument; pass a Dribbble username, e.g. halolab');
    process.exitCode = 1;
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling any command that resolves through `designer` (which calls requireDesigner) with: undefined/null, an empty string, a string of only spaces, or a non-string value that coerces to '' (e.g. 0 is fine but '' is not).

Common situations: Forgetting to pass the designer flag on the CLI, reading the value from an unset environment variable or empty config field, or a script variable that is empty because an earlier lookup returned nothing.

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/b274c2e3fc05d192. Report an issue: GitHub.