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 an int

What it means

Config schema enforcer for type 'integer': parseInt on the raw value produced NaN or Infinity, so the setting being written at keyPath cannot be coerced to an integer. Almost always means a hand-edited config.json or a caller passing a non-numeric string (e.g. '500px').

Source

Thrown at app/src/config.ts:765

    app.configPersistenceManager.setRawValue(keyPath, value, webContentsId);
    this.load();
  }
}

// Base schema enforcers. These will coerce raw input into the specified type,
// and will throw an error when the value cannot be coerced. Throwing the error
// will indicate that the value should not be set.
//
// Enforcers are run from most specific to least. For a schema with type
// `integer`, all the enforcers for the `integer` type will be run first, in
// order of specification. Then the `*` enforcers will be run, in order of
// 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;

View on GitHub (pinned to 648c685d60)

Solutions

  1. Fix the value at the reported keyPath in config.json to a plain integer
  2. If set programmatically, pass a number or numeric string without units/suffixes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/config.ts:765 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/8bd32e5b52b9f44f. Report an issue: GitHub.