{"record":{"id":"2aefab922c6157b4","repo":"can1357/oh-my-pi","slug":"invalid-number-rawvalue","errorCode":null,"errorMessage":"Invalid number: ${rawValue}","messagePattern":"Invalid number: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/config-cli.ts","lineNumber":193,"sourceCode":"// Schema-Driven Value Parsing\n// =============================================================================\n\nfunction parseAndSetValue(path: SettingPath, rawValue: string): void {\n\tconst schemaType = getType(path);\n\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}`);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/config-cli.ts#L175-L211","documentation":"For number-typed settings, `omp config set` coerces the trimmed value with Number() and requires a finite result. If the value parses to NaN or Infinity (or is empty/non-numeric), this error is thrown and the setting is left unchanged.","triggerScenarios":"`omp config set <number-key> <value>` where <value> is non-numeric text, empty, or something like `10ms`, `50%`, `1e999` (Infinity).","commonSituations":"Including units in the value (`500ms` instead of `500`); typos like `0,5` (comma decimal); locale-formatted numbers with thousands separators; empty string from an unquoted shell variable.","solutions":["Pass a plain finite number without units: `omp config set <key> 500`.","Convert units yourself before setting (ms → number, % → fraction).","Check the variable you're interpolating isn't empty or malformed: `echo \"$MY_VALUE\"` first.","Run `omp config get <key>` to confirm the setting's type is number."],"exampleFix":"// before\n$ omp config set request-timeout 500ms\n// after\n$ omp config set request-timeout 500","handlingStrategy":"validation","validationCode":"function setNumber(key: string, raw: string) {\n  const n = Number(raw.trim());\n  if (!Number.isFinite(n)) throw new Error(`${raw} is not a finite number`);\n  return Bun.$`omp config set ${key} ${String(n)}`;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip units (ms, %) before setting numeric values","Use dot decimals, not locale comma decimals","Check interpolated shell variables are non-empty and numeric before passing them"],"tags":["cli","config","validation","number"],"backgroundTag":"invalid-config-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}