n8n-io/n8n · error · TypeORMError
Provided "take" value is not a number. Please provide a nume
Error message
Provided "take" value is not a number. Please provide a numeric value.
What it means
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.
Source
Thrown at packages/@n8n/typeorm/src/query-builder/SelectQueryBuilder.ts:1362
* then use the skip method instead.
*/
offset(offset?: number): this {
this.expressionMap.offset = this.normalizeNumber(offset);
if (this.expressionMap.offset !== undefined && isNaN(this.expressionMap.offset))
throw new TypeORMError(
`Provided "offset" value is not a number. Please provide a numeric value.`,
);
return this;
}
/**
* Sets maximal number of entities to take.
*/
take(take?: number): this {
this.expressionMap.take = this.normalizeNumber(take);
if (this.expressionMap.take !== undefined && isNaN(this.expressionMap.take))
throw new TypeORMError(
`Provided "take" value is not a number. Please provide a numeric value.`,
);
return this;
}
/**
* Sets number of entities to skip.
*/
skip(skip?: number): this {
this.expressionMap.skip = this.normalizeNumber(skip);
if (this.expressionMap.skip !== undefined && isNaN(this.expressionMap.skip))
throw new TypeORMError(
`Provided "skip" value is not a number. Please provide a numeric value.`,
);
return this;
}View on GitHub (pinned to 5ac6606e81)
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).
Example fix
// before qb.take(process.env.PAGE_SIZE); // string from env // after const take = Number(process.env.PAGE_SIZE); qb.take(Number.isFinite(take) && take > 0 ? take : 50);
Defensive patterns
Strategy: validation
Validate before calling
function toTake(value: unknown, fallback = 50, max = 500): number {
if (value == null || value === '') return fallback;
const n = Number(value);
if (!Number.isFinite(n) || n <= 0) throw new Error(`Invalid take: ${String(value)}`);
return Math.min(Math.trunc(n), max);
}
// then: qb.take(toTake(process.env.PAGE_SIZE)); Type guard
function isPositiveInt(v: unknown): v is number {
return typeof v === 'number' && Number.isInteger(v) && v > 0;
} Prevention
- 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.
When it happens
Trigger: `.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.
Common situations: 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.
Related errors
- Provided "limit" value is not a number. Please provide a num
- Provided "offset" value is not a number. Please provide a nu
- Provided "skip" value is not a number. Please provide a nume
- Could not find any entity of type "${target}" matching: ${cr
- Property "${propertyPath}" was not found in "${metadata.targ
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/7f7d80069c2a7959.
Report an issue: GitHub.