can1357/oh-my-pi · error · Error
Invalid array JSON: ${rawValue}
Error message
Invalid array JSON: ${rawValue} What it means
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.
Source
Thrown at packages/coding-agent/src/cli/config-cli.ts:208
}
case "number":
parsedValue = Number(trimmed);
if (!Number.isFinite(parsedValue)) throw new Error(`Invalid number: ${rawValue}`);
break;
case "enum": {
const valid = getEnumValues(path);
if (valid && !valid.includes(trimmed)) {
throw new Error(`Invalid value: ${rawValue}. Valid values: ${valid.join(", ")}`);
}
parsedValue = trimmed;
break;
}
case "array": {
let parsed: unknown;
try {
parsed = JSON.parse(trimmed);
} catch {
throw new Error(`Invalid array JSON: ${rawValue}`);
}
if (!Array.isArray(parsed)) {
throw new Error(`Invalid array JSON: ${rawValue}`);
}
parsedValue = parsed;
break;
}
case "record": {
let parsed: unknown;
try {
parsed = JSON.parse(trimmed);
} catch {
throw new Error(`Invalid record JSON: ${rawValue}`);
}
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
throw new Error(`Invalid record JSON: ${rawValue}`);
}
if (path === "providers.maxInFlightRequests") {View on GitHub (pinned to 9690622007)
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.
Example fix
// before: shell strips inner quotes → invalid JSON $ omp config set allowed-tools ["edit", "bash"] // after $ omp config set allowed-tools '["edit", "bash"]'
Defensive patterns
Strategy: validation
Validate before calling
function setArray(key: string, json: string) {
JSON.parse(json); // throws early with a precise JSON syntax error
return Bun.$`omp config set ${key} ${json}`;
} Prevention
- 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`
When it happens
Trigger: `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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid boolean value: ${rawValue}. Use true/false, yes/no,
- Invalid number: ${rawValue}
- Invalid value: ${rawValue}. Valid values: ${valid.join(", ")
- Invalid record JSON: ${rawValue}
- Failed to load tree-sitter language: {err}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/432f900c7db19e46.
Report an issue: GitHub.