{"record":{"id":"39c43c6976b9621c","repo":"garrytan/gstack","slug":"usage-b-skill-run-name-arg-k-v-timeo","errorCode":null,"errorMessage":"Usage: $B skill run <name> [--arg k=v]... [--timeout=Ns]","messagePattern":"Usage: \\$B skill run <name> \\[--arg k=v\\]\\.\\.\\. \\[--timeout=Ns\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"browse/src/browser-skill-commands.ts","lineNumber":147,"sourceCode":"\nexport function parseSkillRunArgs(args: string[]): ParsedRunArgs {\n  const passthrough: string[] = [];\n  let timeoutSeconds = DEFAULT_TIMEOUT_SECONDS;\n  for (let i = 0; i < args.length; i++) {\n    const a = args[i];\n    if (a.startsWith('--timeout=')) {\n      const n = parseInt(a.slice('--timeout='.length), 10);\n      if (!isNaN(n) && n > 0) timeoutSeconds = n;\n      continue;\n    }\n    passthrough.push(a);\n  }\n  return { passthrough, timeoutSeconds };\n}\n\nasync function handleRun(args: string[], ctx: SkillCommandContext): Promise<string> {\n  const name = args[0];\n  if (!name) throw new Error('Usage: $B skill run <name> [--arg k=v]... [--timeout=Ns]');\n  const tiers = ctx.tiers ?? defaultTierPaths();\n  const skill = readBrowserSkill(name, tiers);\n  if (!skill) throw new Error(`Skill \"${name}\" not found.`);\n\n  const { passthrough, timeoutSeconds } = parseSkillRunArgs(args.slice(1));\n  const result = await spawnSkill({\n    skill,\n    skillArgs: passthrough,\n    trusted: skill.frontmatter.trusted,\n    timeoutSeconds,\n    port: ctx.port,\n  });\n\n  if (result.exitCode !== 0 || result.timedOut || result.truncated) {\n    const summary = result.truncated\n      ? `truncated stdout at ${MAX_STDOUT_BYTES} bytes`\n      : result.timedOut\n        ? `timed out after ${timeoutSeconds}s`","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/browser-skill-commands.ts#L129-L165","documentation":"Thrown by handleRun when args[0] is falsy — the caller invoked `$B skill run` with no skill name. Identical shape to the show-usage guard but for the run path; parseSkillRunArgs is never reached because the name check short-circuits first.","triggerScenarios":"handleSkillCommand(['run'], ctx) or ['run','--timeout=30'] with no positional name before the flags — note parseSkillRunArgs would happily put '--timeout=30' into passthrough, so the name guard fires first to prevent a nonsense lookup.","commonSituations":"Agent constructs the run command from a template and forgets to substitute the name; user passes only flags; argument array was built by splitting an empty/whitespace-only name segment.","solutions":["Re-run with a name: `$B skill run <name> [--arg k=v]... [--timeout=Ns]`.","Put the name before any flags: `$B skill run hn-frontpage --arg k=v`.","Run `$B skill list` to confirm the exact name spelling."],"exampleFix":"// before\n$B skill run --timeout=30\n// after\n$B skill run hn-frontpage --timeout=30","handlingStrategy":"validation","validationCode":"function requireRunArgs(args: string[]): { name: string; rest: string[] } {\n  const name = args[0];\n  if (!name || name.startsWith('--')) {\n    throw new Error('Usage: $B skill run <name> [--arg k=v]... [--timeout=Ns]');\n  }\n  return { name, rest: args.slice(1) };\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always place the skill name before any flags in `skill run`.","Templates that build run commands should use a placeholder that errors if unsubstituted.","Run `$B skill list` to copy exact names."],"tags":["cli-usage","skill-management","gstack"],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}