FlowiseAI/Flowise · error · Error

Invalid URL

Error message

Invalid URL

What it means

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.

Source

Thrown at packages/components/nodes/documentloaders/Cheerio/Cheerio.ts:139

        const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
        const metadata = nodeData.inputs?.metadata
        const relativeLinksMethod = nodeData.inputs?.relativeLinksMethod as string
        const selectedLinks = nodeData.inputs?.selectedLinks as string[]
        let limit = parseInt(nodeData.inputs?.limit as string)
        const output = nodeData.outputs?.output as string
        const orgId = options.orgId

        const _omitMetadataKeys = nodeData.inputs?.omitMetadataKeys as string

        let omitMetadataKeys: string[] = []
        if (_omitMetadataKeys) {
            omitMetadataKeys = _omitMetadataKeys.split(',').map((key) => key.trim())
        }

        let url = nodeData.inputs?.url as string
        url = url.trim()
        if (!test(url)) {
            throw new Error('Invalid URL')
        }

        const selector: SelectorType = nodeData.inputs?.selector as SelectorType

        let params: CheerioWebBaseLoaderParams = {}
        if (selector) {
            parse(selector) // comes with cheerio - will throw error if invalid
            params['selector'] = selector
        }

        async function cheerioLoader(url: string): Promise<any> {
            try {
                await checkDenyList(url)
                let docs: IDocument[] = []
                if (url.endsWith('.pdf')) {
                    if (process.env.DEBUG === 'true')
                        options.logger.info(`[${orgId}]: CheerioWebBaseLoader does not support PDF files: ${url}`)
                    return docs

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Prefix the URL with http:// or https:// explicitly.
  2. Trim and confirm the URL prints correctly in nodeData.inputs.url at runtime.
  3. If a schemeless form is expected from users, normalize upstream: url = /^https?:\/\//i.test(url) ? url : `https://${url}`.

Example fix

// before
let url = nodeData.inputs?.url as string
url = url.trim()
if (!test(url)) {
  throw new Error('Invalid URL')
}
// after - normalize scheme first, then validate
let url = (nodeData.inputs?.url as string)?.trim() ?? ''
if (url && !/^https?:\/\//i.test(url)) url = `https://${url}`
if (!test(url)) {
  throw new Error(`Invalid URL: ${JSON.stringify(nodeData.inputs?.url)}`)
}
Defensive patterns

Strategy: validation

Validate before calling

import { test as linkifyTest } from 'linkifyjs'

function normalizeAndValidateUrl(raw: unknown): string {
  if (typeof raw !== 'string') throw new Error(`url input must be a string, got ${typeof raw}`)
  let url = raw.trim()
  if (url && !/^https?:\/\//i.test(url)) url = `https://${url}`
  if (!linkifyTest(url)) throw new Error(`Invalid URL after normalization: ${JSON.stringify(raw)}`)
  return url
}
// const url = normalizeAndValidateUrl(nodeData.inputs?.url)

Type guard

function isValidUrl(value: unknown): value is string {
  return typeof value === 'string' && value.trim() !== '' && test(value.trim())
}

Prevention

When it happens

Trigger: 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'.

Common situations: User pastes a domain without scheme; templated {{variable}} produces empty string; copy-paste introduced a leading space that survived earlier processing.

Related errors


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