{"record":{"id":"432f900c7db19e46","repo":"can1357/oh-my-pi","slug":"invalid-array-json-rawvalue","errorCode":null,"errorMessage":"Invalid array JSON: ${rawValue}","messagePattern":"Invalid array JSON: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/config-cli.ts","lineNumber":208,"sourceCode":"\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\": {\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 record JSON: ${rawValue}`);\n\t\t\t}\n\t\t\tif (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\t\t\tthrow new Error(`Invalid record JSON: ${rawValue}`);\n\t\t\t}\n\t\t\tif (path === \"providers.maxInFlightRequests\") {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/config-cli.ts#L190-L226","documentation":"For array-typed settings, `omp config set` requires the value to be valid JSON AND for the parsed result to actually be an array. When JSON.parse fails on the trimmed input (syntax error), this error is thrown and the setting is left unchanged.","triggerScenarios":"`omp config set <array-key> <value>` where <value> is not valid JSON — unquoted shell stripping double quotes (`[a, b]`), single-quoted JSON (`['a','b']`), or trailing commas.","commonSituations":"Shell quote-stripping removing the JSON double quotes; using single quotes inside the JSON because of habit; passing a comma-separated list without brackets; Windows cmd quoting differences.","solutions":["Wrap the whole JSON in single quotes so the shell preserves inner double quotes: `omp config set <key> '[\"a\",\"b\"]'`.","Validate the JSON in a linter/JSON parser before passing it.","Use `--json`-safe quoting for your shell (e.g. on Windows cmd escape inner quotes).","Run `omp config get <key>` to see the expected array shape."],"exampleFix":"// before: shell strips inner quotes → invalid JSON\n$ omp config set allowed-tools [\"edit\", \"bash\"]\n// after\n$ omp config set allowed-tools '[\"edit\", \"bash\"]'","handlingStrategy":"validation","validationCode":"function setArray(key: string, json: string) {\n  JSON.parse(json); // throws early with a precise JSON syntax error\n  return Bun.$`omp config set ${key} ${json}`;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Single-quote the whole JSON argument so the shell preserves inner double quotes","Always use valid JSON (double quotes, no trailing commas) — not a comma-separated list","Validate with `JSON.parse` or a JSON linter before invoking `omp config set`"],"tags":["cli","config","json","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}