{"record":{"id":"44657a27939d2188","repo":"garrytan/gstack","slug":"unknown-host-val-use-all-host-names-join","errorCode":null,"errorMessage":"Unknown host: ${val}. Use ${ALL_HOST_NAMES.join(', ')}, or all.","messagePattern":"Unknown host: (.+?)\\. Use (.+?), or all\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/gen-skill-docs.ts","lineNumber":91,"sourceCode":"  let list = hostConfig.suppressedResolvers || [];\n  if (GBRAIN_OVERRIDE.detected) {\n    list = list.filter(r => r !== 'GBRAIN_CONTEXT_LOAD' && r !== 'GBRAIN_SAVE_RESULTS');\n  }\n  return new Set(list);\n}\n\n// ─── Host Detection (config-driven) ─────────────────────────\n\nconst HOST_ARG = process.argv.find(a => a.startsWith('--host'));\ntype HostArg = Host | 'all';\nconst HOST_ARG_VAL: HostArg = (() => {\n  if (!HOST_ARG) return 'claude';\n  const val = HOST_ARG.includes('=') ? HOST_ARG.split('=')[1] : process.argv[process.argv.indexOf(HOST_ARG) + 1];\n  if (val === 'all') return 'all';\n  try {\n    return resolveHostArg(val) as Host;\n  } catch {\n    throw new Error(`Unknown host: ${val}. Use ${ALL_HOST_NAMES.join(', ')}, or all.`);\n  }\n})();\n\n// For single-host mode, HOST is the host. For --host all, it's set per iteration below.\nlet HOST: Host = HOST_ARG_VAL === 'all' ? 'claude' : HOST_ARG_VAL;\n\n// ─── Model Overlay Selection ────────────────────────────────\n// --model is explicit. We do NOT auto-detect from host (host ≠ model).\n// Default is 'claude'. Missing overlay file → empty string (graceful).\nimport { ALL_MODEL_NAMES, resolveModel, type Model } from './models';\nconst MODEL_ARG = process.argv.find(a => a.startsWith('--model'));\nconst MODEL_ARG_VAL: Model = (() => {\n  if (!MODEL_ARG) return 'claude';\n  const val = MODEL_ARG.includes('=') ? MODEL_ARG.split('=')[1] : process.argv[process.argv.indexOf(MODEL_ARG) + 1];\n  const resolved = resolveModel(val);\n  if (!resolved) {\n    throw new Error(`Unknown model: ${val}. Use ${ALL_MODEL_NAMES.join(', ')}, or a family variant (e.g., claude-opus-4-7, gpt-5.4-mini, o3).`);\n  }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/scripts/gen-skill-docs.ts#L73-L109","documentation":"Thrown by the HOST_ARG_VAL IIFE in scripts/gen-skill-docs.ts:91 when the --host CLI flag receives a value that resolveHostArg() rejects. The catch block re-wraps the underlying failure with the canonical list ALL_HOST_NAMES plus the literal 'all' wildcard so the user sees valid options. It exists to fail fast at build start rather than emitting docs into the wrong host directory.","triggerScenarios":"Running `bun run gen:skill-docs -- --host foo` where foo is not in ALL_HOST_NAMES. Using the --host=foo form with a typo. Passing a host name that existed in an older gstack release but was renamed or removed.","commonSituations":"Version drift across gstack releases (a host was renamed). Typos like `--host claudecode` instead of `claude`. Copying a CI invocation from a different repo whose host list differs. Confusing model names with host names.","solutions":["Run `bun run gen:skill-docs` with no --host flag to default to 'claude'","Use `--host all` to iterate every supported host","Pick a literal exactly from the message's comma-separated ALL_HOST_NAMES list","If you added a new host, register it via resolveHostArg/ALL_HOST_NAMES in scripts/models.ts (or host-config) before invoking"],"exampleFix":"// before\nbun run gen:skill-docs -- --host claudecode\n// after\nbun run gen:skill-docs -- --host claude","handlingStrategy":"validation","validationCode":"import { ALL_HOST_NAMES } from './models';\nconst VALID_HOSTS = new Set<string>([...ALL_HOST_NAMES, 'all']);\nconst hostArg = process.argv.find(a => a.startsWith('--host'));\nconst hostVal = hostArg?.includes('=') ? hostArg.split('=')[1] : process.argv[process.argv.indexOf(hostArg!) + 1];\nif (hostVal != null && !VALID_HOSTS.has(hostVal)) {\n  console.error(`--host must be one of: ${[...VALID_HOSTS].join(', ')}`);\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  execFileSync('bun', ['run', 'gen:skill-docs', '--', `--host=${host}`], { stdio: 'inherit' });\n} catch (e) {\n  const msg = String((e as Error).message ?? e);\n  if (/Unknown host/.test(msg)) {\n    console.error('Build aborted: invalid --host. Check ALL_HOST_NAMES.');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["List valid hosts first: `bun run host-config-export list`","Treat the comma-separated list in the error message as authoritative","Default to 'claude' (omit the flag) when unsure","Pin the host name in CI to avoid drift across releases"],"tags":["cli","argument-validation","build","host"],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}