{"record":{"id":"7f7d80069c2a7959","repo":"n8n-io/n8n","slug":"provided-take-value-is-not-a-number-please-prov","errorCode":null,"errorMessage":"Provided \"take\" value is not a number. Please provide a numeric value.","messagePattern":"Provided \"take\" value is not a number\\. Please provide a numeric value\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/query-builder/SelectQueryBuilder.ts","lineNumber":1362,"sourceCode":"\t * then use the skip method instead.\n\t */\n\toffset(offset?: number): this {\n\t\tthis.expressionMap.offset = this.normalizeNumber(offset);\n\t\tif (this.expressionMap.offset !== undefined && isNaN(this.expressionMap.offset))\n\t\t\tthrow new TypeORMError(\n\t\t\t\t`Provided \"offset\" value is not a number. Please provide a numeric value.`,\n\t\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets maximal number of entities to take.\n\t */\n\ttake(take?: number): this {\n\t\tthis.expressionMap.take = this.normalizeNumber(take);\n\t\tif (this.expressionMap.take !== undefined && isNaN(this.expressionMap.take))\n\t\t\tthrow new TypeORMError(\n\t\t\t\t`Provided \"take\" value is not a number. Please provide a numeric value.`,\n\t\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets number of entities to skip.\n\t */\n\tskip(skip?: number): this {\n\t\tthis.expressionMap.skip = this.normalizeNumber(skip);\n\t\tif (this.expressionMap.skip !== undefined && isNaN(this.expressionMap.skip))\n\t\t\tthrow new TypeORMError(\n\t\t\t\t`Provided \"skip\" value is not a number. Please provide a numeric value.`,\n\t\t\t);\n\n\t\treturn this;\n\t}","sourceCodeStart":1344,"sourceCodeEnd":1380,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/query-builder/SelectQueryBuilder.ts#L1344-L1380","documentation":"Thrown by SelectQueryBuilder.take when the normalized value is NaN. `take` is the pagination primitive recommended over `limit` when joins are involved; the same numeric guard applies.","triggerScenarios":"`.take('foo')`, `.take(undefined-as-string)`, `.take(NaN)` after a malformed calculation, or passing a config object's pageSize that loaded as a string from JSON/env.","commonSituations":"Env-var-driven page sizes (always strings) fed directly; feature-flag configs that conditionally set take to a stringified number; join-based pagination where the author switched from limit() to take() but kept the string arg.","solutions":["Parse env/config once at load: `const TAKE = Number(process.env.PAGE_SIZE)` and validate finiteness.","Use a helper: `const take = toFiniteNumber(value, 50)` returning a default.","Pass undefined instead of '' or '0' (0 is valid but may not be intended)."],"exampleFix":"// before\nqb.take(process.env.PAGE_SIZE); // string from env\n// after\nconst take = Number(process.env.PAGE_SIZE);\nqb.take(Number.isFinite(take) && take > 0 ? take : 50);","handlingStrategy":"validation","validationCode":"function toTake(value: unknown, fallback = 50, max = 500): number {\n  if (value == null || value === '') return fallback;\n  const n = Number(value);\n  if (!Number.isFinite(n) || n <= 0) throw new Error(`Invalid take: ${String(value)}`);\n  return Math.min(Math.trunc(n), max);\n}\n// then: qb.take(toTake(process.env.PAGE_SIZE));","typeGuard":"function isPositiveInt(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v > 0;\n}","tryCatchPattern":null,"preventionTips":["Coerce env/config values to numbers at load time.","Apply an upper bound on take to prevent unbounded result sets.","Default to a fallback rather than forwarding empty strings."],"tags":["typeorm","query-builder","validation","pagination"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}