{"record":{"id":"d45732af211d7415","repo":"can1357/oh-my-pi","slug":"invalid-service-tier-value-json-stringify-val","errorCode":null,"errorMessage":"Invalid --service-tier value: ${JSON.stringify(value)}. Expected one of: ${SERVICE_TIER_OPENAI_VALUES.join(\", \")}.","messagePattern":"Invalid --service-tier value: (.+?)\\. Expected one of: (.+?)\\.","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/flag-tables.ts","lineNumber":157,"sourceCode":"\t},\n\t\"--slow\": (result, value) => {\n\t\tresult.slow = value;\n\t},\n\t\"--plan\": (result, value) => {\n\t\tresult.plan = value;\n\t},\n\t\"--prewalk-into\": (result, value) => {\n\t\tresult.prewalkInto = value;\n\t},\n\t\"--plan-yolo-into\": (result, value) => {\n\t\tresult.planYoloInto = value;\n\t},\n\t\"--max-time\": (result, value) => {\n\t\tresult.maxTime = parseMaxTimeSeconds(value);\n\t},\n\t\"--service-tier\": (result, value) => {\n\t\tif (!isServiceTierOpenAISettingValue(value)) {\n\t\t\tthrow new CliUsageError(\n\t\t\t\t`Invalid --service-tier value: ${JSON.stringify(value)}. Expected one of: ${SERVICE_TIER_OPENAI_VALUES.join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t\tresult.serviceTier = value;\n\t},\n\t\"--api-key\": (result, value) => {\n\t\tresult.apiKey = value;\n\t},\n\t\"--system-prompt\": (result, value) => {\n\t\tresult.systemPrompt = value;\n\t},\n\t\"--append-system-prompt\": (result, value) => {\n\t\tresult.appendSystemPrompt = value;\n\t},\n\t\"--provider-session-id\": (result, value) => {\n\t\tresult.providerSessionId = value;\n\t},\n\t\"--prompt-cache-key\": (result, value) => {","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/flag-tables.ts#L139-L175","documentation":"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.","triggerScenarios":"`--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.","commonSituations":"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.","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"],"exampleFix":"// before\nomp <cmd> --service-tier Priority\n// after\nomp <cmd> --service-tier priority","handlingStrategy":"validation","validationCode":"const SERVICE_TIERS = ['auto','flex','priority','default']; // match the CLI's accepted set / error message\nif (!SERVICE_TIERS.includes(value)) throw new Error(`--service-tier must be one of: ${SERVICE_TIERS.join(', ')}`);","typeGuard":"type ServiceTier = (typeof SERVICE_TIERS)[number];\nconst isServiceTier = (v: string): v is ServiceTier =>\n  (SERVICE_TIERS as readonly string[]).includes(v);","tryCatchPattern":"try {\n  parse(['--service-tier', tier]);\n} catch (e) {\n  if (e instanceof CliUsageError && e.message.includes('--service-tier')) {\n    console.error(`Pick a listed tier: ${e.message.match(/Expected one of: (.+)\\./)?.[1]}`);\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","argument-validation","openai","flag-parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}