can1357/oh-my-pi · error
invalid model ${model}; expected provider/model
Error message
invalid model ${model}; expected provider/model What it means
Each --model value must be of the form provider/model: it must contain a '/' that is neither the first character nor the last. This error is thrown for values violating that shape.
Source
Thrown at packages/metaharness/src/tb/cli.ts:204
config.vmonToken = take();
break;
case "--list":
config.list = true;
break;
case "-h":
case "--help":
config.help = true;
break;
default:
throw new Error(`unknown option: ${arg}`);
}
}
if (config.help) return config;
if (config.models.length === 0) throw new Error("at least one --model is required");
for (const model of config.models) {
const slash = model.indexOf("/");
if (slash <= 0 || slash === model.length - 1) throw new Error(`invalid model ${model}; expected provider/model`);
}
for (const [flag, value] of [
["--attempts", config.attempts],
["--concurrency", config.concurrency],
["--epochs", config.epochs],
] as const) {
if (!Number.isInteger(value) || value < 1) throw new Error(`${flag} must be a positive integer`);
}
if (config.budget !== null && (!Number.isFinite(config.budget) || config.budget < 0)) {
throw new Error("--budget must be a non-negative number");
}
return config;
}
class Semaphore {
#available: number;
#queue: Array<() => void> = [];
View on GitHub (pinned to 9690622007)
Solutions
- Use full provider/model form, e.g. anthropic/claude-sonnet-4
- Remove leading/trailing slashes from the value
- Check for empty values caused by unquoted shell variables
Example fix
// before $ tb --model claude-sonnet-4 // after $ tb --model anthropic/claude-sonnet-4
Defensive patterns
Strategy: validation
Validate before calling
const validModel = (m: string) => {
const s = m.indexOf("/");
return s > 0 && s < m.length - 1;
};
if (!models.every(validModel)) throw new Error("every model must be provider/model"); Try / catch
try {
config = parseArgs(args);
} catch (err) {
if (String(err.message).startsWith("invalid model")) {
console.error(`${err.message} — use e.g. anthropic/claude-sonnet-4`);
process.exit(2);
}
throw err;
} Prevention
- Always prefix bare model names with their provider id
- Trim model strings from env/config before passing
- Validate model lists at script boundaries
When it happens
Trigger: Passing a bare model name ('claude-sonnet-4'), a leading-slash ('/gpt-4o'), a trailing slash ('openrouter/'), or an empty string via --model=.
Common situations: Model IDs from docs that omit the provider prefix; joining a list where the last element is empty; Windows-style paths or typos introducing stray slashes; using an OpenRouter variant-only suffix instead of the full id.
Related errors
- invalid {} argument: {}
- invalid Zero increment value: {}
- --agents must be a positive integer
- --trusted-extension requires a non-empty, non-flag value
- --trusted-extension requires an absolute path: ${trustedPath
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/53f0e3d6fe96a674.
Report an issue: GitHub.