{"record":{"id":"8bd32e5b52b9f44f","repo":"Foundry376/Mailspring","slug":"validation-failed-at-keypath-json-stringify","errorCode":null,"errorMessage":"Validation failed at ${keyPath}, ${JSON.stringify(value)} cannot be coerced into an int","messagePattern":"Validation failed at (.+?), (.+?) cannot be coerced into an int","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/src/config.ts","lineNumber":765,"sourceCode":"    app.configPersistenceManager.setRawValue(keyPath, value, webContentsId);\n    this.load();\n  }\n}\n\n// Base schema enforcers. These will coerce raw input into the specified type,\n// and will throw an error when the value cannot be coerced. Throwing the error\n// will indicate that the value should not be set.\n//\n// Enforcers are run from most specific to least. For a schema with type\n// `integer`, all the enforcers for the `integer` type will be run first, in\n// order of specification. Then the `*` enforcers will be run, in order of\n// specification.\nConfig.addSchemaEnforcers({\n  integer: {\n    coerce(keyPath, value, schema) {\n      value = parseInt(value, 10);\n      if (isNaN(value) || !isFinite(value)) {\n        throw new Error(\n          `Validation failed at ${keyPath}, ${JSON.stringify(value)} cannot be coerced into an int`\n        );\n      }\n      return value;\n    },\n  },\n\n  number: {\n    coerce(keyPath, value, schema) {\n      value = parseFloat(value);\n      if (isNaN(value) || !isFinite(value)) {\n        throw new Error(\n          `Validation failed at ${keyPath}, ${JSON.stringify(\n            value\n          )} cannot be coerced into a number`\n        );\n      }\n      return value;","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/config.ts#L747-L783","documentation":"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').","triggerScenarios":"Thrown at app/src/config.ts:765 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the value at the reported keyPath in config.json to a plain integer","If set programmatically, pass a number or numeric string without units/suffixes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"648c685d602ece6bb00c22534b8734de6ac644b3","analyzedAt":"2026-09-03T02:00:24.311Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}