{"record":{"id":"f3c2600651513549","repo":"jackwener/OpenCLI","slug":"name-required-or-pass-list","errorCode":null,"errorMessage":"name required (or pass --list)","messagePattern":"name required \\(or pass --list\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/skill.js","lineNumber":179,"sourceCode":"    ],\n    columns: ['Index', 'Name', 'Description'],\n    func: async (page, kwargs) => {\n        await switchToPanel(page, 'Skills');\n        await ensureSkillsTab(page, 'Skills Marketplace');\n        const listOnly = kwargs.list === true || kwargs.list === 'true';\n        const name = String(kwargs.name || '').trim().toLowerCase();\n\n        const cats = await page.evaluate(`(function() {\n      return Array.from(document.querySelectorAll('.marketplace-tag'))\n        .filter((c) => c.offsetParent)\n        .map((c) => ({ text: (c.textContent || '').trim(), active: c.className.includes('active') }));\n    })()`);\n\n        if (listOnly) {\n            return (cats || []).map((c) => ({ Index: '-', Name: c.text + (c.active ? ' (active)' : ''), Description: '' }));\n        }\n        if (!name) {\n            throw new ArgumentError('name required (or pass --list)');\n        }\n\n        const nameJson = JSON.stringify(name);\n        const switchRes = await page.evaluate(`(async () => {\n      const wait = (ms) => new Promise((r) => setTimeout(r, ms));\n      const tag = Array.from(document.querySelectorAll('.marketplace-tag'))\n        .find((t) => t.offsetParent && (t.textContent || '').trim().toLowerCase().includes(${nameJson}));\n      if (!tag) return { ok: false, reason: 'Category not found.' };\n      const r = tag.getBoundingClientRect();\n      const init = {\n        bubbles: true, cancelable: true, button: 0, buttons: 1,\n        clientX: Math.round(r.left + r.width / 2),\n        clientY: Math.round(r.top + r.height / 2),\n      };\n      tag.dispatchEvent(new PointerEvent('pointerdown', { ...init, pointerType: 'mouse' }));\n      tag.dispatchEvent(new MouseEvent('mousedown', init));\n      tag.dispatchEvent(new PointerEvent('pointerup', { ...init, pointerType: 'mouse' }));\n      tag.dispatchEvent(new MouseEvent('mouseup', init));","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/skill.js#L161-L197","documentation":"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.","triggerScenarios":"Calling skill-category with neither a name argument nor listOnly=true — e.g. kwargs.name undefined and no --list flag passed.","commonSituations":"Scripts that build kwargs dynamically and drop the name; user expecting a default category; confusing the list mode with the switch mode.","solutions":["Pass the category name, e.g. --name \"Productivity\", or pass --list to enumerate categories first.","Use --list to discover valid category names, then re-run with the chosen name.","Fix scripts so the name variable is always set when not listing."],"exampleFix":"// before\nawait skillCategory({})\n// after\nawait skillCategory({ list: true }) // or { name: 'Productivity' }","handlingStrategy":"validation","validationCode":"function requireCategoryOrList(kwargs) {\n  const name = String(kwargs.name || '').trim();\n  if (!name && !kwargs.list) throw new Error('Pass a category name or --list');\n  return name;\n}","typeGuard":"function isCategoryInvocation(kwargs) {\n  return (typeof kwargs.name === 'string' && kwargs.name.trim().length > 0) || kwargs.list === true;\n}","tryCatchPattern":"try {\n  await skillCategory(kwargs);\n} catch (e) {\n  if (e instanceof ArgumentError && /name required/.test(e.message)) {\n    // auto-fallback: run with --list and show options\n  } else throw e;\n}","preventionTips":["Always pass either a name or --list when invoking skill-category.","Use --list first to discover valid category names.","In scripts, default to listOnly when the name variable is unset."],"tags":["argument","validation","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}