{"record":{"id":"27d0c50e35ca3d35","repo":"FlowiseAI/Flowise","slug":"searxng-api-base-not-set-you-can-set-it-as-searx","errorCode":null,"errorMessage":"SEARXNG_API_BASE not set. You can set it as \"SEARXNG_API_BASE\" in your environment variables.","messagePattern":"SEARXNG_API_BASE not set\\. You can set it as \"SEARXNG_API_BASE\" in your environment variables\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/components/nodes/tools/Searxng/Searxng.ts","lineNumber":266,"sourceCode":"        apiBase,\n        params,\n        headers,\n        toolName,\n        toolDescription\n    }: {\n        apiBase?: string\n        params?: SearxngSearchParams\n        headers?: SearxngCustomHeaders\n        toolName?: string\n        toolDescription?: string\n    }) {\n        super(...arguments)\n\n        this.apiBase = apiBase\n        this.headers = { 'content-type': 'application/json', ...headers }\n\n        if (!this.apiBase) {\n            throw new Error(`SEARXNG_API_BASE not set. You can set it as \"SEARXNG_API_BASE\" in your environment variables.`)\n        }\n\n        if (params) {\n            this.params = { ...this.params, ...params }\n        }\n\n        if (toolName) {\n            this.name = toolName\n        }\n\n        if (toolDescription) {\n            this.description = toolDescription\n        }\n    }\n\n    protected buildUrl<P extends SearxngSearchParams>(path: string, parameters: P, baseUrl: string): string {\n        const nonUndefinedParams: [string, string][] = Object.entries(parameters)\n            .filter(([_, value]) => value !== undefined)","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/Searxng/Searxng.ts#L248-L284","documentation":"Thrown in the Searxng constructor when `apiBase` is not provided. This is a hard construction-time failure: the tool cannot be instantiated at all without a SearxNG API base URL. The message tells the user to set the SEARXNG_API_BASE environment variable.","triggerScenarios":"Calling `new SearxngTool(...)` (or super(...)) without an `apiBase` argument and without a SEARXNG_API_BASE env var. Because Flowise passes apiBase explicitly from node config, the typical trigger is a node whose API base field is empty.","commonSituations":"Searxng node configured without an API base; SEARXNG_API_BASE env var unset on the Flowise server; the value was bound to a credential/variable that resolved empty; self-hosted SearxNG URL typo.","solutions":["Set SEARXNG_API_BASE in the Flowise server environment (e.g. export SEARXNG_API_BASE=https://search.example.com).","Pass `apiBase` explicitly when constructing the tool.","In the Searxng node config, fill the API base field with the full URL to the SearxNG instance.","Restart the Flowise process after setting the env var."],"exampleFix":"// before\nconst tool = new SearxngTool({} as any) // throws: SEARXNG_API_BASE not set\n\n// after\nprocess.env.SEARXNG_API_BASE = 'https://search.example.com'\n// or pass explicitly:\nconst tool = new SearxngTool({ apiBase: 'https://search.example.com' })","handlingStrategy":"validation","validationCode":"function buildSearxngTool(overrides: Record<string, unknown> = {}) {\n  const apiBase = overrides.apiBase ?? process.env.SEARXNG_API_BASE\n  if (!apiBase || !/^https?:\\/\\//.test(apiBase)) {\n    throw new Error('SEARXNG_API_BASE missing or invalid — set it in the environment or pass apiBase')\n  }\n  return new SearxngTool({ apiBase, ...overrides } as any)\n}","typeGuard":"const hasSearxngBase = (env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { SEARXNG_API_BASE: string } =>\n  typeof env.SEARXNG_API_BASE === 'string' && /^https?:\\/\\//.test(env.SEARXNG_API_BASE)","tryCatchPattern":"try {\n  return buildSearxngTool({ apiBase })\n} catch (e) {\n  if (/SEARXNG_API_BASE not set/.test((e as Error).message)) {\n    throw new Error('Searxng unavailable: configure SEARXNG_API_BASE in Flowise server env')\n  }\n  throw e\n}","preventionTips":["Set SEARXNG_API_BASE in the Flowise server environment at deploy time.","Add a startup health check that pings the SearxNG base before serving flows.","Validate apiBase is a fully-qualified URL before constructing the tool."],"tags":["configuration","environment","searxng","constructor"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}