{"record":{"id":"2dcbe7646e1c49e4","repo":"FlowiseAI/Flowise","slug":"invalid-url","errorCode":null,"errorMessage":"Invalid URL","messagePattern":"Invalid URL","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/Cheerio/Cheerio.ts","lineNumber":139,"sourceCode":"        const textSplitter = nodeData.inputs?.textSplitter as TextSplitter\n        const metadata = nodeData.inputs?.metadata\n        const relativeLinksMethod = nodeData.inputs?.relativeLinksMethod as string\n        const selectedLinks = nodeData.inputs?.selectedLinks as string[]\n        let limit = parseInt(nodeData.inputs?.limit as string)\n        const output = nodeData.outputs?.output as string\n        const orgId = options.orgId\n\n        const _omitMetadataKeys = nodeData.inputs?.omitMetadataKeys as string\n\n        let omitMetadataKeys: string[] = []\n        if (_omitMetadataKeys) {\n            omitMetadataKeys = _omitMetadataKeys.split(',').map((key) => key.trim())\n        }\n\n        let url = nodeData.inputs?.url as string\n        url = url.trim()\n        if (!test(url)) {\n            throw new Error('Invalid URL')\n        }\n\n        const selector: SelectorType = nodeData.inputs?.selector as SelectorType\n\n        let params: CheerioWebBaseLoaderParams = {}\n        if (selector) {\n            parse(selector) // comes with cheerio - will throw error if invalid\n            params['selector'] = selector\n        }\n\n        async function cheerioLoader(url: string): Promise<any> {\n            try {\n                await checkDenyList(url)\n                let docs: IDocument[] = []\n                if (url.endsWith('.pdf')) {\n                    if (process.env.DEBUG === 'true')\n                        options.logger.info(`[${orgId}]: CheerioWebBaseLoader does not support PDF files: ${url}`)\n                    return docs","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Cheerio/Cheerio.ts#L121-L157","documentation":"Cheerio loader validates the input URL with linkifyjs' test() before doing any work. linkifyjs' test() returns false for strings that are not a recognizable standalone URL (no scheme, scheme-only, multiple spaces, control characters). It is stricter than a regex URL check and rejects 'localhost:3000', bare paths, etc.","triggerScenarios":"url input is empty after trim; 'example.com' without https://; trailing spaces or newlines that confuse linkifyjs; URL bound to a variable that resolved to undefined and became the string 'undefined'.","commonSituations":"User pastes a domain without scheme; templated {{variable}} produces empty string; copy-paste introduced a leading space that survived earlier processing.","solutions":["Prefix the URL with http:// or https:// explicitly.","Trim and confirm the URL prints correctly in nodeData.inputs.url at runtime.","If a schemeless form is expected from users, normalize upstream: url = /^https?:\\/\\//i.test(url) ? url : `https://${url}`."],"exampleFix":"// before\nlet url = nodeData.inputs?.url as string\nurl = url.trim()\nif (!test(url)) {\n  throw new Error('Invalid URL')\n}\n// after - normalize scheme first, then validate\nlet url = (nodeData.inputs?.url as string)?.trim() ?? ''\nif (url && !/^https?:\\/\\//i.test(url)) url = `https://${url}`\nif (!test(url)) {\n  throw new Error(`Invalid URL: ${JSON.stringify(nodeData.inputs?.url)}`)\n}","handlingStrategy":"validation","validationCode":"import { test as linkifyTest } from 'linkifyjs'\n\nfunction normalizeAndValidateUrl(raw: unknown): string {\n  if (typeof raw !== 'string') throw new Error(`url input must be a string, got ${typeof raw}`)\n  let url = raw.trim()\n  if (url && !/^https?:\\/\\//i.test(url)) url = `https://${url}`\n  if (!linkifyTest(url)) throw new Error(`Invalid URL after normalization: ${JSON.stringify(raw)}`)\n  return url\n}\n// const url = normalizeAndValidateUrl(nodeData.inputs?.url)","typeGuard":"function isValidUrl(value: unknown): value is string {\n  return typeof value === 'string' && value.trim() !== '' && test(value.trim())\n}","tryCatchPattern":null,"preventionTips":["Always include the http:// or https:// scheme.","Trim whitespace before validation.","Reject templated values that resolve to the literal string 'undefined' or 'null'."],"tags":["validation","url","cheerio","configuration"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}