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

ExecuteFlow.run resolves baseURL from nodeData.inputs.executeFlowBaseURL or options.baseURL, then requires it to be truthy and pass isValidURL. An empty or malformed URL aborts before the prediction request is built. This guards the outbound POST to ${baseURL}/api/v1/prediction/${selectedFlowId}.

Source

Thrown at packages/components/nodes/agentflow/ExecuteFlow/ExecuteFlow.ts:187

        let overrideConfig = nodeData.inputs?.executeFlowOverrideConfig
        if (typeof overrideConfig === 'string' && overrideConfig.startsWith('{') && overrideConfig.endsWith('}')) {
            try {
                overrideConfig = parseJsonBody(overrideConfig)
            } catch (parseError) {
                throw new Error(`Invalid JSON in executeFlowOverrideConfig: ${parseError.message}`)
            }
        }

        const state = options.agentflowRuntime?.state as ICommonObject
        const runtimeChatHistory = (options.agentflowRuntime?.chatHistory as BaseMessageLike[]) ?? []
        const isLastNode = options.isLastNode as boolean
        const sseStreamer: IServerSideEventStreamer | undefined = options.sseStreamer

        try {
            const credentialData = await getCredentialData(nodeData.credential ?? '', options)
            const chatflowApiKey = getCredentialParam('chatflowApiKey', credentialData, nodeData)

            if (!baseURL || !isValidURL(baseURL)) throw new Error('Invalid base URL: must be a valid URL')

            if (selectedFlowId === options.chatflowid) throw new Error('Cannot call the same agentflow!')

            let headers: Record<string, string> = {
                'Content-Type': 'application/json',
                'flowise-tool': 'true'
            }
            if (chatflowApiKey) headers = { ...headers, Authorization: `Bearer ${chatflowApiKey}` }

            const finalUrl = `${baseURL}/api/v1/prediction/${selectedFlowId}`
            const requestConfig: AxiosRequestConfig = {
                method: 'POST',
                url: finalUrl,
                headers,
                data: {
                    question: flowInput,
                    chatId: options.chatId,
                    overrideConfig

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Set executeFlowBaseURL to a full absolute URL including scheme, e.g. 'https://flowise.example.com'.
  2. If relying on options.baseURL, ensure the runtime injects it (check the host/orchestrator config).
  3. Trim whitespace and remove surrounding quotes from the value.
  4. Verify the URL with `new URL(baseURL)` in a scratch script.

Example fix

// before
executeFlowBaseURL = 'localhost:3000'

// after
executeFlowBaseURL = 'http://localhost:3000'
Defensive patterns

Strategy: validation

Validate before calling

function resolveBaseURL(nodeData, options) {
  const url = (nodeData.inputs?.executeFlowBaseURL as string) || (options.baseURL as string)
  try { new URL(url) }
  catch { throw new Error('executeFlowBaseURL must be a valid absolute URL, e.g. https://host') }
  return url
}

Type guard

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

Try / catch

try { await executeFlow.run(nodeData, '', options) }
catch (e) {
  if (e.message === 'Invalid base URL: must be a valid URL') {
    // set executeFlowBaseURL to a valid absolute URL and retry
  } else throw e
}

Prevention

When it happens

Trigger: executeFlowBaseURL left empty and no options.baseURL provided; baseURL missing the scheme (e.g. 'localhost:3000'); URL with spaces or invalid characters; baseURL set to a relative path; trailing slash or typo breaking URL parsing.

Common situations: Environment where options.baseURL is not injected; node configured with a placeholder like '<your-url>'; copy-paste including quotes or whitespace; reverse-proxy/domain change not reflected in the node config.

Related errors


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