{"record":{"id":"145530ea822d7f86","repo":"FlowiseAI/Flowise","slug":"limit-cannot-be-less-than-0-145530","errorCode":null,"errorMessage":"Limit cannot be less than 0","messagePattern":"Limit cannot be less than 0","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/components/nodes/documentloaders/Playwright/Playwright.ts","lineNumber":274,"sourceCode":"                    docs = await loader.load()\n                    docs = await textSplitter.splitDocuments(docs)\n                } else {\n                    docs = await loader.load()\n                }\n                return docs\n            } catch (err) {\n                if (process.env.DEBUG === 'true')\n                    options.logger.error(`[${orgId}]: Error in PlaywrightWebBaseLoader: ${err.message}, on page: ${url}`)\n            }\n        }\n\n        let docs: Document[] = []\n        if (relativeLinksMethod) {\n            if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Start PlaywrightWebBaseLoader ${relativeLinksMethod}`)\n            // if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined\n            // so when limit is 0 we can fetch all the links\n            if (limit === null || limit === undefined) limit = 10\n            else if (limit < 0) throw new Error('Limit cannot be less than 0')\n            const pages: string[] =\n                selectedLinks && selectedLinks.length > 0\n                    ? selectedLinks.slice(0, limit === 0 ? undefined : limit)\n                    : relativeLinksMethod === 'webCrawl'\n                    ? await webCrawl(url, limit)\n                    : await xmlScrape(url, limit)\n            if (process.env.DEBUG === 'true')\n                options.logger.info(`[${orgId}]: PlaywrightWebBaseLoader pages: ${JSON.stringify(pages)}, length: ${pages.length}`)\n            if (!pages || pages.length === 0) throw new Error('No relative links found')\n            for (const page of pages) {\n                const result = await playwrightLoader(page)\n                if (result) {\n                    docs.push(...result)\n                }\n            }\n            if (process.env.DEBUG === 'true') options.logger.info(`[${orgId}]: Finish PlaywrightWebBaseLoader ${relativeLinksMethod}`)\n        } else if (selectedLinks && selectedLinks.length > 0) {\n            if (process.env.DEBUG === 'true')","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Playwright/Playwright.ts#L256-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Set limit to 0 for 'all links', a positive integer for a cap, or leave empty for the default of 10.","If the value comes from a variable, clamp it: Math.max(0, limit).","Guard against NaN: after parseInt, check Number.isNaN(limit) and reset to default."],"exampleFix":"// before\nlet limit = parseInt(nodeData.inputs?.limit as string)\nif (limit === null || limit === undefined) limit = 10\nelse if (limit < 0) throw new Error('Limit cannot be less than 0')\n// after - handle NaN and clamp\nlet limit = parseInt(nodeData.inputs?.limit as string)\nif (Number.isNaN(limit)) limit = 10\nif (limit < 0) throw new Error('Limit cannot be less than 0')","handlingStrategy":"validation","validationCode":"function parseLimit(input) {\n  if (input == null || input === '') return 10\n  const n = Number(input)\n  if (!Number.isFinite(n)) throw new Error('limit must be a number')\n  if (n < 0) throw new Error('Limit cannot be less than 0')\n  return Math.floor(n)\n}","typeGuard":"function isNonNegativeInt(v) { return Number.isInteger(v) && v >= 0 }","tryCatchPattern":null,"preventionTips":["Use 0 for 'all links', a positive int for a cap, or empty for the default.","Clamp variable-sourced limits with Math.max(0, n).","Guard against NaN after parseInt.","Document the 0-means-all behavior to users."],"tags":["playwright","validation","numeric-input","scraping"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}