{"record":{"id":"b1a6bc59b84402e9","repo":"can1357/oh-my-pi","slug":"invalid-value-rawvalue-valid-values-valid","errorCode":null,"errorMessage":"Invalid value: ${rawValue}. Valid values: ${valid.join(\", \")}","messagePattern":"Invalid value: (.+?)\\. Valid values: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/config-cli.ts","lineNumber":198,"sourceCode":"\tlet parsedValue: unknown;\n\n\tconst trimmed = rawValue.trim();\n\tswitch (schemaType) {\n\t\tcase \"boolean\": {\n\t\t\tconst lower = trimmed.toLowerCase();\n\t\t\tif ([\"true\", \"1\", \"yes\", \"on\"].includes(lower)) parsedValue = true;\n\t\t\telse if ([\"false\", \"0\", \"no\", \"off\"].includes(lower)) parsedValue = false;\n\t\t\telse throw new Error(`Invalid boolean value: ${rawValue}. Use true/false, yes/no, on/off, or 1/0`);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\":\n\t\t\tparsedValue = Number(trimmed);\n\t\t\tif (!Number.isFinite(parsedValue)) throw new Error(`Invalid number: ${rawValue}`);\n\t\t\tbreak;\n\t\tcase \"enum\": {\n\t\t\tconst valid = getEnumValues(path);\n\t\t\tif (valid && !valid.includes(trimmed)) {\n\t\t\t\tthrow new Error(`Invalid value: ${rawValue}. Valid values: ${valid.join(\", \")}`);\n\t\t\t}\n\t\t\tparsedValue = trimmed;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"array\": {\n\t\t\tlet parsed: unknown;\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(trimmed);\n\t\t\t} catch {\n\t\t\t\tthrow new Error(`Invalid array JSON: ${rawValue}`);\n\t\t\t}\n\t\t\tif (!Array.isArray(parsed)) {\n\t\t\t\tthrow new Error(`Invalid array JSON: ${rawValue}`);\n\t\t\t}\n\t\t\tparsedValue = parsed;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"record\": {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/config-cli.ts#L180-L216","documentation":"For enum-typed settings, `omp config set` checks the trimmed value against the schema's allowed values from getEnumValues. If the value isn't in the list, this error is thrown and helpfully includes all valid values, leaving the setting unchanged.","triggerScenarios":"`omp config set <enum-key> <value>` where <value> isn't one of the schema's enum members — wrong case, a deprecated value, or a value from a different setting.","commonSituations":"Typing `dark-theme` instead of `dark`; using values from an older version whose enum has since changed; confusing two similarly named settings with different enums.","solutions":["Use one of the values listed in the error message exactly (case-sensitive).","Run `omp config get <key>` or `omp config list` to see the current valid enum values.","If migrating from an older version, check the changelog for renamed enum members.","If you believe the value should be valid, verify the setting key is correct — enums differ per key."],"exampleFix":"// before\n$ omp config set theme dark-mode\n// after\n$ omp config set theme dark","handlingStrategy":"validation","validationCode":"// discover valid values first\nconst current = await Bun.$`omp config get ${key}`.quiet().text();\n// or run `omp config list` and copy the value verbatim from the enum column","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy-paste enum values from the error message or `omp config list` instead of typing them","Respect case-sensitivity of enum members","After upgrading, re-check renamed enum values from the changelog"],"tags":["cli","config","validation","enum"],"backgroundTag":"invalid-config-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}