jackwener/OpenCLI · error · ArgumentError

name required (or pass --list)

Error message

name required (or pass --list)

What it means

Thrown as an ArgumentError when the skill-category command is invoked without a category name and without the --list flag. Listing categories is allowed without a name, but switching to a specific category requires one.

Source

Thrown at clis/trae-solo/skill.js:179

    ],
    columns: ['Index', 'Name', 'Description'],
    func: async (page, kwargs) => {
        await switchToPanel(page, 'Skills');
        await ensureSkillsTab(page, 'Skills Marketplace');
        const listOnly = kwargs.list === true || kwargs.list === 'true';
        const name = String(kwargs.name || '').trim().toLowerCase();

        const cats = await page.evaluate(`(function() {
      return Array.from(document.querySelectorAll('.marketplace-tag'))
        .filter((c) => c.offsetParent)
        .map((c) => ({ text: (c.textContent || '').trim(), active: c.className.includes('active') }));
    })()`);

        if (listOnly) {
            return (cats || []).map((c) => ({ Index: '-', Name: c.text + (c.active ? ' (active)' : ''), Description: '' }));
        }
        if (!name) {
            throw new ArgumentError('name required (or pass --list)');
        }

        const nameJson = JSON.stringify(name);
        const switchRes = await page.evaluate(`(async () => {
      const wait = (ms) => new Promise((r) => setTimeout(r, ms));
      const tag = Array.from(document.querySelectorAll('.marketplace-tag'))
        .find((t) => t.offsetParent && (t.textContent || '').trim().toLowerCase().includes(${nameJson}));
      if (!tag) return { ok: false, reason: 'Category not found.' };
      const r = tag.getBoundingClientRect();
      const init = {
        bubbles: true, cancelable: true, button: 0, buttons: 1,
        clientX: Math.round(r.left + r.width / 2),
        clientY: Math.round(r.top + r.height / 2),
      };
      tag.dispatchEvent(new PointerEvent('pointerdown', { ...init, pointerType: 'mouse' }));
      tag.dispatchEvent(new MouseEvent('mousedown', init));
      tag.dispatchEvent(new PointerEvent('pointerup', { ...init, pointerType: 'mouse' }));
      tag.dispatchEvent(new MouseEvent('mouseup', init));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass the category name, e.g. --name "Productivity", or pass --list to enumerate categories first.
  2. Use --list to discover valid category names, then re-run with the chosen name.
  3. Fix scripts so the name variable is always set when not listing.

Example fix

// before
await skillCategory({})
// after
await skillCategory({ list: true }) // or { name: 'Productivity' }
Defensive patterns

Strategy: validation

Validate before calling

function requireCategoryOrList(kwargs) {
  const name = String(kwargs.name || '').trim();
  if (!name && !kwargs.list) throw new Error('Pass a category name or --list');
  return name;
}

Type guard

function isCategoryInvocation(kwargs) {
  return (typeof kwargs.name === 'string' && kwargs.name.trim().length > 0) || kwargs.list === true;
}

Try / catch

try {
  await skillCategory(kwargs);
} catch (e) {
  if (e instanceof ArgumentError && /name required/.test(e.message)) {
    // auto-fallback: run with --list and show options
  } else throw e;
}

Prevention

When it happens

Trigger: Calling skill-category with neither a name argument nor listOnly=true — e.g. kwargs.name undefined and no --list flag passed.

Common situations: Scripts that build kwargs dynamically and drop the name; user expecting a default category; confusing the list mode with the switch mode.

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