FlowiseAI/Flowise · warning · Error

Limit cannot be less than 0

Error message

Limit cannot be less than 0

What it means

Thrown by the Playwright loader after parsing the limit input: an explicit integer less than zero is rejected. Null/undefined default to 10 and 0 means 'fetch all', so only a negative integer triggers this.

Source

Thrown at packages/components/nodes/documentloaders/Playwright/Playwright.ts:274

                    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 PlaywrightWebBaseLoader: ${err.message}, on page: ${url}`)
            }
        }

        let docs: Document[] = []
        if (relativeLinksMethod) {
            if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Start PlaywrightWebBaseLoader ${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}]: PlaywrightWebBaseLoader 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 playwrightLoader(page)
                if (result) {
                    docs.push(...result)
                }
            }
            if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Finish PlaywrightWebBaseLoader ${relativeLinksMethod}`)
        } else if (selectedLinks && selectedLinks.length > 0) {
            if (process.env.DEBUG === 'true')

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Set limit to 0 for 'all links', a positive integer for a cap, or leave empty for the default of 10.
  2. If the value comes from a variable, clamp it: Math.max(0, limit).
  3. Guard against NaN: after parseInt, check Number.isNaN(limit) and reset to default.

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 - handle NaN and clamp
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

When it happens

Trigger: limit input field set to a negative number like -1; a templated/variable value resolving to a negative number string that parseInt then parses to a negative int.

Common situations: User types -1 expecting 'unlimited'; upstream node emits a negative count due to a math error; empty string parses to NaN (which passes the < 0 check as false, so it would NOT throw — beware the NaN gap).

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/145530ea822d7f86. Report an issue: GitHub.