Foundry376/Mailspring · error · Error

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

Error message

Validation failed at ${keyPath}, ${JSON.stringify(value)} cannot be coerced into a number

What it means

Config schema enforcer for type 'number': parseFloat on the raw value produced NaN or Infinity, so the value cannot be coerced to a float. Typically a malformed string (empty, trailing text) written to the config file or passed to config.set.

Source

Thrown at app/src/config.ts:777

// specification.
Config.addSchemaEnforcers({
  integer: {
    coerce(keyPath, value, schema) {
      value = parseInt(value, 10);
      if (isNaN(value) || !isFinite(value)) {
        throw new Error(
          `Validation failed at ${keyPath}, ${JSON.stringify(value)} cannot be coerced into an int`
        );
      }
      return value;
    },
  },

  number: {
    coerce(keyPath, value, schema) {
      value = parseFloat(value);
      if (isNaN(value) || !isFinite(value)) {
        throw new Error(
          `Validation failed at ${keyPath}, ${JSON.stringify(
            value
          )} cannot be coerced into a number`
        );
      }
      return value;
    },
  },

  boolean: {
    coerce(keyPath, value, schema) {
      switch (typeof value) {
        case 'string':
          if (value.toLowerCase() === 'true') {
            return true;
          } else if (value.toLowerCase() === 'false') {
            return false;
          } else {

View on GitHub (pinned to 648c685d60)

Solutions

  1. Correct the value at keyPath to a valid number (no stray characters)
  2. Validate user numeric input before passing it to config.set
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/config.ts:777 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/68983a5401fbb40f. Report an issue: GitHub.