Foundry376/Mailspring · error · Error

Validation failed at ${keyPath}, ${JSON.stringify(value)} is

Error message

Validation failed at ${keyPath}, ${JSON.stringify(value)} is not one of ${JSON.stringify(possibleValues)}

What it means

Config schema enum validator: the schema for keyPath declares an enum list, and the value deep-compares (_.isEqual) equal to none of the allowed entries. Common for locale, theme, or layout keys whose accepted values are fixed; the offending value and full allowed list are printed.

Source

Thrown at app/src/config.ts:921

        value = Math.min(value, schema.maximum);
      }
      return value;
    },

    validateEnum(keyPath, value, schema) {
      const possibleValues = schema.enum;
      if (possibleValues == null || !Array.isArray(possibleValues) || !possibleValues.length) {
        return value;
      }

      for (const possibleValue of possibleValues) {
        // Using `isEqual` for possibility of placing enums on array and object schemas
        if (_.isEqual(possibleValue, value)) {
          return value;
        }
      }

      throw new Error(
        `Validation failed at ${keyPath}, ${JSON.stringify(value)} is not one of ${JSON.stringify(
          possibleValues
        )}`
      );
    },
  },
});

function isPlainObject(value) {
  return _.isObject(value) && !_.isArray(value) && !_.isFunction(value) && !_.isString(value);
}

function splitKeyPath(keyPath) {
  if (keyPath == null) {
    return [];
  }
  let startIndex = 0;
  const keyPathArray = [];

View on GitHub (pinned to 648c685d60)

Solutions

  1. Set the key to one of the values listed in the error message
  2. Update the plugin/package that wrote an outdated enum value after the allowed set changed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/config.ts:921 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03). Data as JSON: /api/errors/75e937e452337db6. Report an issue: GitHub.