FlowiseAI/Flowise · error · Error

Invalid URL

Error message

Invalid URL

What it means

Thrown by the Playwright loader init() when linkifyjs' test(url) returns false for the trimmed input URL. test() only validates strings that look like real URLs (scheme + host), so a bare domain, missing protocol, or malformed string fails.

Source

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

            | 'domcontentloaded'
            | 'networkidle'
            | 'commit'
            | undefined
        const waitForSelector = nodeData.inputs?.waitForSelector as string
        const cssSelector = nodeData.inputs?.cssSelector as string
        const _omitMetadataKeys = nodeData.inputs?.omitMetadataKeys as string
        const output = nodeData.outputs?.output as string
        const orgId = options.orgId

        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')
        }

        async function playwrightLoader(url: string): Promise<Document[] | undefined> {
            try {
                await checkDenyList(url)
                let docs = []

                const executablePath = process.env.PLAYWRIGHT_EXECUTABLE_PATH

                const config: PlaywrightWebBaseLoaderOptions = {
                    launchOptions: {
                        args: ['--no-sandbox'],
                        headless: true,
                        executablePath: executablePath
                    }
                }
                if (waitUntilGoToOption) {
                    config['gotoOptions'] = {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Prepend the scheme: ensure input is 'https://example.com' not 'example.com'.
  2. Normalize with new URL(url) before validation to catch scheme-less inputs.
  3. Trim and strip stray characters (smart quotes, zero-width spaces) before testing.
  4. If you must allow internal/localhost hosts, validate with a custom regex instead of linkifyjs test().

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, use the URL constructor as source of truth
let url = (nodeData.inputs?.url as string)?.trim() ?? ''
if (!/^https?:\/\//i.test(url)) url = `https://${url}`
try { new URL(url) } catch { throw new Error(`Invalid URL: ${url}`) }
Defensive patterns

Strategy: validation

Validate before calling

function normalizeAndValidateUrl(raw) {
  let u = (raw ?? '').toString().trim()
  if (!u) throw new Error('URL is required')
  if (!/^https?:\/\//i.test(u)) u = `https://${u}`
  try { new URL(u) } catch { throw new Error(`Invalid URL: ${u}`) }
  return u
}

Type guard

function isValidHttpUrl(s) {
  try { const u = new URL(s); return u.protocol === 'http:' || u.protocol === 'https:' }
  catch { return false }
}

Prevention

When it happens

Trigger: Input is 'example.com' without a scheme; input is 'example' with no dot/TLD; input has leading/trailing junk that survives .trim(); input is empty; input is a relative path like '/page'.

Common situations: User pastes a domain without https://; URL field bound to a variable that resolved to undefined then coerced to 'undefined'; copy-paste introduces a leading space or smart quote; using a localhost/internal host that linkifyjs does not recognize.

Related errors


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