can1357/oh-my-pi · error · Error

Invalid value: ${rawValue}. Valid values: ${valid.join(", ")

Error message

Invalid value: ${rawValue}. Valid values: ${valid.join(", ")}

What it means

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.

Source

Thrown at packages/coding-agent/src/cli/config-cli.ts:198

	let parsedValue: unknown;

	const trimmed = rawValue.trim();
	switch (schemaType) {
		case "boolean": {
			const lower = trimmed.toLowerCase();
			if (["true", "1", "yes", "on"].includes(lower)) parsedValue = true;
			else if (["false", "0", "no", "off"].includes(lower)) parsedValue = false;
			else throw new Error(`Invalid boolean value: ${rawValue}. Use true/false, yes/no, on/off, or 1/0`);
			break;
		}
		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": {

View on GitHub (pinned to 9690622007)

Solutions

  1. Use one of the values listed in the error message exactly (case-sensitive).
  2. Run `omp config get <key>` or `omp config list` to see the current valid enum values.
  3. If migrating from an older version, check the changelog for renamed enum members.
  4. If you believe the value should be valid, verify the setting key is correct — enums differ per key.

Example fix

// before
$ omp config set theme dark-mode
// after
$ omp config set theme dark
Defensive patterns

Strategy: validation

Validate before calling

// discover valid values first
const current = await Bun.$`omp config get ${key}`.quiet().text();
// or run `omp config list` and copy the value verbatim from the enum column

Prevention

When it happens

Trigger: `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.

Common situations: 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.

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


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/b1a6bc59b84402e9. Report an issue: GitHub.