garrytan/gstack · error · Error

Unknown host: ${val}. Use ${ALL_HOST_NAMES.join(', ')}, or a

Error message

Unknown host: ${val}. Use ${ALL_HOST_NAMES.join(', ')}, or all.

What it means

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.

Source

Thrown at scripts/gen-skill-docs.ts:91

  let list = hostConfig.suppressedResolvers || [];
  if (GBRAIN_OVERRIDE.detected) {
    list = list.filter(r => r !== 'GBRAIN_CONTEXT_LOAD' && r !== 'GBRAIN_SAVE_RESULTS');
  }
  return new Set(list);
}

// ─── Host Detection (config-driven) ─────────────────────────

const HOST_ARG = process.argv.find(a => a.startsWith('--host'));
type HostArg = Host | 'all';
const HOST_ARG_VAL: HostArg = (() => {
  if (!HOST_ARG) return 'claude';
  const val = HOST_ARG.includes('=') ? HOST_ARG.split('=')[1] : process.argv[process.argv.indexOf(HOST_ARG) + 1];
  if (val === 'all') return 'all';
  try {
    return resolveHostArg(val) as Host;
  } catch {
    throw new Error(`Unknown host: ${val}. Use ${ALL_HOST_NAMES.join(', ')}, or all.`);
  }
})();

// For single-host mode, HOST is the host. For --host all, it's set per iteration below.
let HOST: Host = HOST_ARG_VAL === 'all' ? 'claude' : HOST_ARG_VAL;

// ─── Model Overlay Selection ────────────────────────────────
// --model is explicit. We do NOT auto-detect from host (host ≠ model).
// Default is 'claude'. Missing overlay file → empty string (graceful).
import { ALL_MODEL_NAMES, resolveModel, type Model } from './models';
const MODEL_ARG = process.argv.find(a => a.startsWith('--model'));
const MODEL_ARG_VAL: Model = (() => {
  if (!MODEL_ARG) return 'claude';
  const val = MODEL_ARG.includes('=') ? MODEL_ARG.split('=')[1] : process.argv[process.argv.indexOf(MODEL_ARG) + 1];
  const resolved = resolveModel(val);
  if (!resolved) {
    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).`);
  }

View on GitHub (pinned to 94993f7401)

Solutions

  1. Run `bun run gen:skill-docs` with no --host flag to default to 'claude'
  2. Use `--host all` to iterate every supported host
  3. Pick a literal exactly from the message's comma-separated ALL_HOST_NAMES list
  4. If you added a new host, register it via resolveHostArg/ALL_HOST_NAMES in scripts/models.ts (or host-config) before invoking

Example fix

// before
bun run gen:skill-docs -- --host claudecode
// after
bun run gen:skill-docs -- --host claude
Defensive patterns

Strategy: validation

Validate before calling

import { ALL_HOST_NAMES } from './models';
const VALID_HOSTS = new Set<string>([...ALL_HOST_NAMES, 'all']);
const hostArg = process.argv.find(a => a.startsWith('--host'));
const hostVal = hostArg?.includes('=') ? hostArg.split('=')[1] : process.argv[process.argv.indexOf(hostArg!) + 1];
if (hostVal != null && !VALID_HOSTS.has(hostVal)) {
  console.error(`--host must be one of: ${[...VALID_HOSTS].join(', ')}`);
  process.exit(2);
}

Try / catch

try {
  execFileSync('bun', ['run', 'gen:skill-docs', '--', `--host=${host}`], { stdio: 'inherit' });
} catch (e) {
  const msg = String((e as Error).message ?? e);
  if (/Unknown host/.test(msg)) {
    console.error('Build aborted: invalid --host. Check ALL_HOST_NAMES.');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12). Data as JSON: /api/errors/44657a27939d2188. Report an issue: GitHub.