FlowiseAI/Flowise · error · Error
Invalid URL
Error message
Invalid URL
What it means
Puppeteer loader equivalent of [170]: thrown when linkifyjs test(url) is false for the trimmed input URL. Same validation semantics — requires a scheme and a recognizable host.
Source
Thrown at packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts:179
const relativeLinksMethod = nodeData.inputs?.relativeLinksMethod as string
const selectedLinks = nodeData.inputs?.selectedLinks as string[]
let limit = parseInt(nodeData.inputs?.limit as string)
const waitUntilGoToOption = nodeData.inputs?.waitUntilGoToOption as PuppeteerLifeCycleEvent
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 puppeteerLoader(url: string): Promise<Document[] | undefined> {
try {
await checkDenyList(url)
let docs: Document[] = []
const executablePath = process.env.PUPPETEER_EXECUTABLE_PATH
const config: PuppeteerWebBaseLoaderOptions = {
launchOptions: {
args: ['--no-sandbox'],
headless: 'new',
executablePath: executablePath
}
}
if (waitUntilGoToOption) {
config['gotoOptions'] = {View on GitHub (pinned to abe4a8601a)
Solutions
- Prepend https:// when the scheme is missing.
- Validate with new URL() as the authoritative check.
- Trim and strip stray characters.
- Use a custom regex for internal hosts if needed.
Example fix
// before
let url = nodeData.inputs?.url as string
url = url.trim()
if (!test(url)) throw new Error('Invalid URL')
// after
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
- Always include the scheme (https://).
- Use new URL() as the validator.
- Strip smart quotes/whitespace from pasted URLs.
- Use a custom regex for internal/localhost hosts.
When it happens
Trigger: Input 'example.com' (no scheme); bare hostname without TLD; empty string; relative path; smart-quote/whitespace contamination.
Common situations: Domain pasted without https://; variable resolved to undefined coerced to string; internal/localhost host not recognized by linkifyjs.
Related errors
- Invalid URL
- Limit cannot be less than 0
- No relative links found
- No relative links found
- Failed to scrape URL. Error: ${responseData.error}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/1bc36ff875bf1192.
Report an issue: GitHub.