FlowiseAI/Flowise · critical · Error

OpenAPI spec does not contain a server URL

Error message

OpenAPI spec does not contain a server URL

What it means

Thrown by OpenAPIToolkit.init after the spec is dereferenced when no base URL can be determined: selectedServer is unset or 'error', and _data.servers is empty or its first entry has no url. The toolkit cannot build absolute request endpoints without a base URL, so initialization aborts.

Source

Thrown at packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts:156

                inputType,
                openApiFile,
                openApiLink
            },
            options
        )
        if (!specData) throw new Error('Failed to load OpenAPI spec')

        const _data: any = await $RefParser.dereference(specData)

        // Use selected server or fallback to first server
        let baseUrl: string
        if (selectedServer && selectedServer !== 'error') {
            baseUrl = selectedServer
        } else {
            baseUrl = _data.servers?.[0]?.url
        }

        if (!baseUrl) throw new Error('OpenAPI spec does not contain a server URL')

        const appDataSource = options.appDataSource as DataSource
        const databaseEntities = options.databaseEntities as IDatabaseEntity
        const variables = await getVars(appDataSource, databaseEntities, nodeData, options)
        const flow = { chatflowId: options.chatflowid }

        let tools = getTools(_data.paths, baseUrl, headers, variables, flow, toolReturnDirect, customCode, removeNulls)

        // Filter by selected endpoints if provided
        const _selected = nodeData.inputs?.selectedEndpoints
        let selected: string[] = []
        if (_selected) {
            try {
                selected = typeof _selected === 'string' ? JSON.parse(_selected) : _selected
            } catch (e) {
                selected = []
            }
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Convert the spec to OpenAPI 3.x so it has a top-level servers array with a valid url, OR manually set selectedServer to a known base URL.
  2. Set the 'Selected Server' dropdown to a concrete URL instead of leaving it on 'error'/'No Servers Found'.
  3. Edit the spec to add a servers entry, e.g. servers: [{ url: 'https://api.example.com' }].
  4. Confirm the spec version; if it is Swagger 2.0, run it through a converter first.

Example fix

// before: spec has no servers
openapi: 3.0.0
info: { title: x, version: '1' }
paths: {}
// after
openapi: 3.0.0
info: { title: x, version: '1' }
servers:
  - url: https://api.example.com
paths: {}
Defensive patterns

Strategy: validation

Validate before calling

function specHasServerUrl(spec: any, selectedServer?: string): boolean {
  if (selectedServer && selectedServer !== 'error') return true
  return Boolean(spec?.servers?.[0]?.url)
}

Type guard

function isOpenApi3WithServer(spec: any): boolean {
  return Boolean(spec && (spec.openapi || '').startsWith('3.') && Array.isArray(spec.servers) && spec.servers[0]?.url)
}

Try / catch

try {
  const tools = await toolkit.init(nodeData, '', options)
} catch (e) {
  if (e instanceof Error && e.message === 'OpenAPI spec does not contain a server URL') {
    // set selectedServer or add a servers entry to the spec
  } else throw e
}

Prevention

When it happens

Trigger: The OpenAPI spec has no top-level servers array (common in OpenAPI 2.0/Swagger specs that rely on host/basePath instead); the servers array exists but the first server's url is empty; selectedServer was never chosen and defaulted to the (missing) first server; selectedServer is the sentinel 'error' value returned by listServers when no servers were found.

Common situations: Using a Swagger 2.0 spec that uses host/basePath rather than servers; the spec's servers entries are malformed; the user saw 'No Servers Found' in the dropdown and proceeded anyway.

Related errors


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