FlowiseAI/Flowise · warning · Error
Limit cannot be less than 0
Error message
Limit cannot be less than 0
What it means
Puppeteer loader equivalent of [171]: a parsed limit integer less than zero is rejected. Null/undefined → 10, 0 → fetch all, negative → error.
Source
Thrown at packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts:268
docs = await loader.load()
docs = await textSplitter.splitDocuments(docs)
} else {
docs = await loader.load()
}
return docs
} catch (err) {
if (process.env.DEBUG === 'true')
options.logger.error(`[${orgId}]: Error in PuppeteerWebBaseLoader: ${err.message}, on page: ${url}`)
}
}
let docs: Document[] = []
if (relativeLinksMethod) {
if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Start PuppeteerWebBaseLoader ${relativeLinksMethod}`)
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
// so when limit is 0 we can fetch all the links
if (limit === null || limit === undefined) limit = 10
else if (limit < 0) throw new Error('Limit cannot be less than 0')
const pages: string[] =
selectedLinks && selectedLinks.length > 0
? selectedLinks.slice(0, limit === 0 ? undefined : limit)
: relativeLinksMethod === 'webCrawl'
? await webCrawl(url, limit)
: await xmlScrape(url, limit)
if (process.env.DEBUG === 'true')
options.logger.info(`[${orgId}]: PuppeteerWebBaseLoader pages: ${JSON.stringify(pages)}, length: ${pages.length}`)
if (!pages || pages.length === 0) throw new Error('No relative links found')
for (const page of pages) {
const result = await puppeteerLoader(page)
if (result) {
docs.push(...result)
}
}
if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Finish PuppeteerWebBaseLoader ${relativeLinksMethod}`)
} else if (selectedLinks && selectedLinks.length > 0) {
if (process.env.DEBUG === 'true')View on GitHub (pinned to abe4a8601a)
Solutions
- Use 0 for all links, a positive int for a cap, or empty for default 10.
- Clamp variable-sourced values with Math.max(0, limit).
- Guard NaN after parseInt.
Example fix
// before
let limit = parseInt(nodeData.inputs?.limit as string)
if (limit === null || limit === undefined) limit = 10
else if (limit < 0) throw new Error('Limit cannot be less than 0')
// after
let limit = parseInt(nodeData.inputs?.limit as string)
if (Number.isNaN(limit)) limit = 10
if (limit < 0) throw new Error('Limit cannot be less than 0') Defensive patterns
Strategy: validation
Validate before calling
function parseLimit(input) {
if (input == null || input === '') return 10
const n = Number(input)
if (!Number.isFinite(n)) throw new Error('limit must be a number')
if (n < 0) throw new Error('Limit cannot be less than 0')
return Math.floor(n)
} Type guard
function isNonNegativeInt(v) { return Number.isInteger(v) && v >= 0 } Prevention
- Use 0 for all links, positive int for a cap, empty for default.
- Clamp variable-sourced values with Math.max(0, n).
- Guard NaN after parseInt.
- Communicate the 0-means-all semantics to users.
When it happens
Trigger: limit field set to a negative integer; templated variable resolving to a negative number.
Common situations: User expects -1 to mean unlimited; upstream math produces a negative count; empty string → NaN bypasses the check (latent gap).
Related errors
- Limit cannot be less than 0
- Invalid URL
- No relative links found
- chatflowId must be a valid array
- dataset.rows must be a valid array
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/5f7b91fcfd9b2814.
Report an issue: GitHub.