FlowiseAI/Flowise · error · Error
Invalid base URL: must be a valid URL
Error message
Invalid base URL: must be a valid URL
What it means
Thrown in AgentAsTool_Tools.init when baseURL is falsy or fails isValidURL. baseURL is the host of the agentflow HTTP API; it falls back to options.baseURL, so the error means neither the node input nor the server default is a usable absolute URL. Without a valid base the tool cannot construct the fetch target.
Source
Thrown at packages/components/nodes/tools/AgentAsTool/AgentAsTool.ts:177
const overrideConfig =
typeof nodeData.inputs?.overrideConfig === 'string' &&
nodeData.inputs.overrideConfig.startsWith('{') &&
nodeData.inputs.overrideConfig.endsWith('}')
? JSON.parse(nodeData.inputs.overrideConfig)
: nodeData.inputs?.overrideConfig
const startNewSession = nodeData.inputs?.startNewSession as boolean
const baseURL = (nodeData.inputs?.baseURL as string) || (options.baseURL as string)
// Validate agentflowid is a valid UUID
if (!selectedAgentflowId || !isValidUUID(selectedAgentflowId)) {
throw new Error('Invalid agentflow ID: must be a valid UUID')
}
// Validate baseURL is a valid URL
if (!baseURL || !isValidURL(baseURL)) {
throw new Error('Invalid base URL: must be a valid URL')
}
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const agentflowApiKey = getCredentialParam('agentflowApiKey', credentialData, nodeData)
if (selectedAgentflowId === options.chatflowid) throw new Error('Cannot call the same agentflow!')
let headers = {}
if (agentflowApiKey) headers = { Authorization: `Bearer ${agentflowApiKey}` }
let toolInput = ''
if (useQuestionFromChat) {
toolInput = input
} else if (customInput) {
toolInput = customInput
}
let name = _name || 'agentflow_tool'View on GitHub (pinned to abe4a8601a)
Solutions
- Set inputs.baseURL to an absolute URL including scheme, e.g. https://app.example.com.
- If relying on the server default, ensure the server's BASE_URL/config is set and propagated into options.baseURL.
- Strip any trailing slash or path from baseURL — only the origin should be configured.
Example fix
// before
const baseURL = (nodeData.inputs?.baseURL as string) || (options.baseURL as string)
// after
const rawBase = (nodeData.inputs?.baseURL as string) || (options.baseURL as string)
const baseURL = rawBase ? new URL(rawBase).origin : ''
if (!baseURL || !isValidURL(baseURL)) {
throw new Error('Invalid base URL: must be a valid URL')
} Defensive patterns
Strategy: validation
Validate before calling
import { isValidURL } from '../../../src/validator'
function resolveBaseURL(node: INodeData, options: ICommonObject): string {
const raw = (node.inputs?.baseURL as string) || (options.baseURL as string)
const base = raw ? new URL(raw).origin : ''
if (!base || !isValidURL(base)) throw new Error('Invalid base URL: must be a valid URL')
return base
} Type guard
function isAbsoluteUrl(v: unknown): v is string {
if (typeof v !== 'string') return false
try { new URL(v); return true } catch { return false }
} Prevention
- Always include the scheme (http:// or https://) in baseURL.
- Set BASE_URL at the server level so options.baseURL is the safety net.
- Use only the origin; avoid trailing paths or slashes.
When it happens
Trigger: Node inputs.baseURL is empty AND options.baseURL is undefined (e.g. running outside the normal server context, or in a test harness); baseURL was entered as a hostname without scheme ('localhost:3000') or with a trailing path that breaks URL composition.
Common situations: Self-hosted deployment where BASE_URL env var was not set; behind a reverse proxy and the configured URL used http vs https inconsistently; local dev entered 'localhost:3000' instead of 'http://localhost:3000'.
Related errors
- Model is required
- Invalid Flow State
- Tool not selected
- Invalid agentflow ID: must be a valid UUID
- Invalid base URL: must be a valid URL
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/7f1a9d01e3d4c3ba.
Report an issue: GitHub.