{"record":{"id":"004228515a04f59c","repo":"n8n-io/n8n","slug":"value-value-is-not-a-number","errorCode":null,"errorMessage":"Value \"${value}\" is not a number.","messagePattern":"Value \"(.+?)\" is not a number\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/entity-manager/EntityManager.ts","lineNumber":1180,"sourceCode":"\t}\n\n\t/**\n\t * Increments some column by provided value of the entities matched given conditions.\n\t */\n\tasync increment<Entity extends ObjectLiteral>(\n\t\tentityClass: EntityTarget<Entity>,\n\t\tconditions: any,\n\t\tpropertyPath: string,\n\t\tvalue: number | string,\n\t): Promise<UpdateResult> {\n\t\tconst metadata = this.connection.getMetadata(entityClass);\n\t\tconst column = metadata.findColumnWithPropertyPath(propertyPath);\n\t\tif (!column)\n\t\t\tthrow new TypeORMError(\n\t\t\t\t`Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n\t\t\t);\n\n\t\tif (isNaN(Number(value))) throw new TypeORMError(`Value \"${value}\" is not a number.`);\n\n\t\t// convert possible embeded path \"social.likes\" into object { social: { like: () => value } }\n\t\tconst values: QueryDeepPartialEntity<Entity> = propertyPath.split('.').reduceRight(\n\t\t\t(value, key) => ({ [key]: value }) as any,\n\t\t\t() => this.connection.driver.escape(column.databaseName) + ' + ' + value,\n\t\t);\n\n\t\treturn this.createQueryBuilder<Entity>(entityClass as any, 'entity')\n\t\t\t.update(entityClass)\n\t\t\t.set(values)\n\t\t\t.where(conditions)\n\t\t\t.execute();\n\t}\n\n\t/**\n\t * Decrements some column by provided value of the entities matched given conditions.\n\t */\n\tasync decrement<Entity extends ObjectLiteral>(","sourceCodeStart":1162,"sourceCodeEnd":1198,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/entity-manager/EntityManager.ts#L1162-L1198","documentation":"In EntityManager.increment, after the column is resolved, the supplied value is coerced via Number(value) and checked with isNaN. If it isn't a finite number (NaN, undefined-coerced, non-numeric string), TypeORM throws `Value \"${value}\" is not a number.`. The check uses Number() rather than typeof, so empty strings and booleans pass while 'abc', undefined, or symbols fail.","triggerScenarios":"Passing a user-controlled or unvalidated string like 'abc' as the increment amount; passing `undefined` accidentally; passing a BigInt (Number(bigint) beyond safe range becomes odd values but small BigInt actually works); passing an object whose toString yields non-numeric text; passing null (Number(null)===0, so it does NOT fire — be aware).","commonSituations":"Form/API input not parsed to a number before reaching increment; default value of an optional parameter silently undefined; a JSON payload where amount came as a string;BigInt/Decimal.js instances that don't coerce cleanly.","solutions":["Coerce and validate the value upstream: `const n = Number(value); if (!Number.isFinite(n)) throw ...`.","Type the parameter as `number` in your service signature so TS rejects string inputs at compile time.","If accepting string input, parse with `Number.parseFloat` and a guard before calling increment.","For null/undefined optional amounts, default to 0 explicitly or skip the call."],"exampleFix":"// before - raw user input\nawait manager.increment(Counter, { id }, req.body.amount);\n\n// after - coerce and validate\nconst amount = Number(req.body.amount);\nif (!Number.isFinite(amount)) {\n  throw new UserError('amount must be a number');\n}\nawait manager.increment(Counter, { id }, amount);","handlingStrategy":"validation","validationCode":"function asFiniteNumber(v: unknown, field = 'value'): number {\n  const n = Number(v);\n  if (!Number.isFinite(n)) throw new UserError(`${field} must be a finite number`);\n  return n;\n}\nawait manager.increment(Entity, conditions, propertyPath, asFiniteNumber(rawValue));","typeGuard":"function isNumericValue(v: unknown): v is number | string {\n  return typeof v === 'number' ? Number.isFinite(v) : typeof v === 'string' && v.trim() !== '' && Number.isFinite(Number(v));\n}","tryCatchPattern":null,"preventionTips":["Type the increment amount as `number` at the service boundary.","Parse and validate string input before calling increment.","Default optional amounts to 0 explicitly.","Add a unit test asserting non-numeric input is rejected upstream."],"tags":["typeorm","increment","validation","api-misuse"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}