{"record":{"id":"57ce7e7b24cb39eb","repo":"stablyai/orca","slug":"invalid-argument-57ce7e","errorCode":"invalid_argument","errorMessage":"Missing skill topic. Available topics: ${availableTopics}","messagePattern":"Missing skill topic\\. Available topics: (.+?)","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/skills.ts","lineNumber":45,"sourceCode":"  markdown: string\n  fullMarkdown: string\n  aliases: readonly string[]\n}\n\nfunction canonicalGuides(guides: readonly BundledSkillGuide[]): BundledSkillGuide[] {\n  return [...guides].sort((left, right) =>\n    left.name < right.name ? -1 : left.name > right.name ? 1 : 0\n  )\n}\n\nfunction requireTopic(\n  flags: Map<string, string | boolean>,\n  guides: BundledSkillGuide[]\n): BundledSkillGuide {\n  const availableTopics = guides.map((guide) => guide.name).join(', ')\n  const topic = flags.get('topic')\n  if (typeof topic !== 'string' || topic.length === 0) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      `Missing skill topic. Available topics: ${availableTopics}`\n    )\n  }\n  // Why: installed stubs may retain an old topic forever, so aliases and canonical\n  // names share one lookup table instead of being treated as transient CLI aliases.\n  const guideByTopic = new Map<string, BundledSkillGuide>(\n    guides.flatMap((guide) => [guide.name, ...guide.aliases].map((name) => [name, guide]))\n  )\n  const guide = guideByTopic.get(topic)\n  if (!guide) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      `Unknown skill topic \"${topic}\". Available topics: ${availableTopics}`\n    )\n  }\n  return guide\n}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/skills.ts#L27-L63","documentation":"Thrown by requireTopic when a skills command that needs a topic is invoked without a usable `--topic` — either the flag is absent, its value is a boolean (flag given no value), or it is an empty string. The message lists all currently available topic names so the user can pick one. This is a client-side precondition check before any guide resolution.","triggerScenarios":"Running a skills topic-scoped subcommand (e.g. skills show/guide) with no `--topic`, with `--topic` alone and no value, or with `--topic \"\"`. The `flags.get('topic')` returns undefined or a non-string/empty and the guard fires.","commonSituations":"Forgetting the flag; assuming the first positional is the topic; an automation script that conditionally includes `--topic` only to leave it blank; shell quoting that collapses an empty variable to nothing.","solutions":["Pass `--topic <name>` using one of the names listed in the error message.","If the list is empty or wrong, your Orca build bundled no/different guides — update Orca or check the install.","In scripts, guard the flag: only emit `--topic` when the variable is non-empty.","Use a guide's alias if you only remember an alternate name (aliases resolve, but a missing topic does not)."],"exampleFix":"// before\norca skills show\nTOPIC=\norca skills show --topic \"$TOPIC\"\n// after\norca skills show --topic <name-from-available-list>\n# in scripts: only pass --topic when set\n[ -n \"$TOPIC\" ] && args+=(--topic \"$TOPIC\")","handlingStrategy":"validation","validationCode":"// requireTopic: flag must be a non-empty string\nconst topic = flags.get('topic')\nconst ok = typeof topic === 'string' && topic.length > 0\nif (!ok) { /* print availableTopics, abort before calling the handler */ }","typeGuard":"function isNonEmptyTopic(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0\n}","tryCatchPattern":"try { await runSkillsTopic(flags) }\ncatch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && e.message.startsWith('Missing skill topic')) {\n    // re-prompt for a topic from the listed available topics\n  } else throw e\n}","preventionTips":["In scripts, only append `--topic` when the variable is non-empty.","Surface the available-topics list to end users before they pick.","Treat an empty/whitespace topic identically to a missing one in wrappers."],"tags":["cli","validation","skills","missing-argument","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}