can1357/oh-my-pi · error · CliUsageError
Invalid --service-tier value: ${JSON.stringify(value)}. Expe
Error message
Invalid --service-tier value: ${JSON.stringify(value)}. Expected one of: ${SERVICE_TIER_OPENAI_VALUES.join(", ")}. What it means
The --service-tier flag setter validates the value against SERVICE_TIER_OPENAI_VALUES (the OpenAI service-tier enum, e.g. auto/flex/priority/default). Unknown strings raise this CliUsageError listing every accepted value, so the message itself documents the valid set.
Source
Thrown at packages/coding-agent/src/cli/flag-tables.ts:157
},
"--slow": (result, value) => {
result.slow = value;
},
"--plan": (result, value) => {
result.plan = value;
},
"--prewalk-into": (result, value) => {
result.prewalkInto = value;
},
"--plan-yolo-into": (result, value) => {
result.planYoloInto = value;
},
"--max-time": (result, value) => {
result.maxTime = parseMaxTimeSeconds(value);
},
"--service-tier": (result, value) => {
if (!isServiceTierOpenAISettingValue(value)) {
throw new CliUsageError(
`Invalid --service-tier value: ${JSON.stringify(value)}. Expected one of: ${SERVICE_TIER_OPENAI_VALUES.join(", ")}.`,
);
}
result.serviceTier = value;
},
"--api-key": (result, value) => {
result.apiKey = value;
},
"--system-prompt": (result, value) => {
result.systemPrompt = value;
},
"--append-system-prompt": (result, value) => {
result.appendSystemPrompt = value;
},
"--provider-session-id": (result, value) => {
result.providerSessionId = value;
},
"--prompt-cache-key": (result, value) => {View on GitHub (pinned to 9690622007)
Solutions
- Use exactly one of the values listed in the error message (they are joined after 'Expected one of:')
- Match casing precisely — the check is a literal membership test
- Omit --service-tier to use the provider default instead of guessing a tier name
- Check the provider actually supports the tier you want; the flag only forwards OpenAI-recognized values
Example fix
// before omp <cmd> --service-tier Priority // after omp <cmd> --service-tier priority
Defensive patterns
Strategy: validation
Validate before calling
const SERVICE_TIERS = ['auto','flex','priority','default']; // match the CLI's accepted set / error message
if (!SERVICE_TIERS.includes(value)) throw new Error(`--service-tier must be one of: ${SERVICE_TIERS.join(', ')}`); Type guard
type ServiceTier = (typeof SERVICE_TIERS)[number]; const isServiceTier = (v: string): v is ServiceTier => (SERVICE_TIERS as readonly string[]).includes(v);
Try / catch
try {
parse(['--service-tier', tier]);
} catch (e) {
if (e instanceof CliUsageError && e.message.includes('--service-tier')) {
console.error(`Pick a listed tier: ${e.message.match(/Expected one of: (.+)\./)?.[1]}`);
} else throw e;
} Prevention
- Copy tier names exactly from the error message or --help (casing matters)
- Don't assume tiers from other providers work; the list is OpenAI's enum
- Omit the flag when unsure — the provider default applies
When it happens
Trigger: `--service-tier something` where something is not in the accepted enum: typos (`flexi`, `prioroty`), wrong casing if the enum is lowercase-only (`Flex`), or tiers from other providers that OpenAI does not support.
Common situations: Users copying service-tier names from another provider's docs, assuming the flag accepts arbitrary provider-specific tiers, or capitalizing the value (`--service-tier Priority`) when only exact enum members pass the type guard.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid --max-time value: ${JSON.stringify(value)}. Expected
- Invalid --surface '${raw}'. Valid values: ${GALLERY_SURFACE_
- unknown file type: {value}
- invalid size: {value}
- 2
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/d45732af211d7415.
Report an issue: GitHub.