{"record":{"id":"6f8c33474817976d","repo":"FlowiseAI/Flowise","slug":"openapi-spec-does-not-contain-a-server-url","errorCode":null,"errorMessage":"OpenAPI spec does not contain a server URL","messagePattern":"OpenAPI spec does not contain a server URL","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts","lineNumber":156,"sourceCode":"                inputType,\n                openApiFile,\n                openApiLink\n            },\n            options\n        )\n        if (!specData) throw new Error('Failed to load OpenAPI spec')\n\n        const _data: any = await $RefParser.dereference(specData)\n\n        // Use selected server or fallback to first server\n        let baseUrl: string\n        if (selectedServer && selectedServer !== 'error') {\n            baseUrl = selectedServer\n        } else {\n            baseUrl = _data.servers?.[0]?.url\n        }\n\n        if (!baseUrl) throw new Error('OpenAPI spec does not contain a server URL')\n\n        const appDataSource = options.appDataSource as DataSource\n        const databaseEntities = options.databaseEntities as IDatabaseEntity\n        const variables = await getVars(appDataSource, databaseEntities, nodeData, options)\n        const flow = { chatflowId: options.chatflowid }\n\n        let tools = getTools(_data.paths, baseUrl, headers, variables, flow, toolReturnDirect, customCode, removeNulls)\n\n        // Filter by selected endpoints if provided\n        const _selected = nodeData.inputs?.selectedEndpoints\n        let selected: string[] = []\n        if (_selected) {\n            try {\n                selected = typeof _selected === 'string' ? JSON.parse(_selected) : _selected\n            } catch (e) {\n                selected = []\n            }\n        }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Set the 'Selected Server' dropdown to a concrete URL instead of leaving it on 'error'/'No Servers Found'.","Edit the spec to add a servers entry, e.g. servers: [{ url: 'https://api.example.com' }].","Confirm the spec version; if it is Swagger 2.0, run it through a converter first."],"exampleFix":"// before: spec has no servers\nopenapi: 3.0.0\ninfo: { title: x, version: '1' }\npaths: {}\n// after\nopenapi: 3.0.0\ninfo: { title: x, version: '1' }\nservers:\n  - url: https://api.example.com\npaths: {}","handlingStrategy":"validation","validationCode":"function specHasServerUrl(spec: any, selectedServer?: string): boolean {\n  if (selectedServer && selectedServer !== 'error') return true\n  return Boolean(spec?.servers?.[0]?.url)\n}","typeGuard":"function isOpenApi3WithServer(spec: any): boolean {\n  return Boolean(spec && (spec.openapi || '').startsWith('3.') && Array.isArray(spec.servers) && spec.servers[0]?.url)\n}","tryCatchPattern":"try {\n  const tools = await toolkit.init(nodeData, '', options)\n} catch (e) {\n  if (e instanceof Error && e.message === 'OpenAPI spec does not contain a server URL') {\n    // set selectedServer or add a servers entry to the spec\n  } else throw e\n}","preventionTips":["Prefer OpenAPI 3.x specs with a populated servers array.","Convert Swagger 2.0 specs before use, or set selectedServer manually.","Do not proceed when the server dropdown shows 'No Servers Found'."],"tags":["openapi","config","init","missing-server"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}