FlowiseAI/Flowise · critical · Error

SEARXNG_API_BASE not set. You can set it as "SEARXNG_API_BAS

Error message

SEARXNG_API_BASE not set. You can set it as "SEARXNG_API_BASE" in your environment variables.

What it means

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.

Source

Thrown at packages/components/nodes/tools/Searxng/Searxng.ts:266

        apiBase,
        params,
        headers,
        toolName,
        toolDescription
    }: {
        apiBase?: string
        params?: SearxngSearchParams
        headers?: SearxngCustomHeaders
        toolName?: string
        toolDescription?: string
    }) {
        super(...arguments)

        this.apiBase = apiBase
        this.headers = { 'content-type': 'application/json', ...headers }

        if (!this.apiBase) {
            throw new Error(`SEARXNG_API_BASE not set. You can set it as "SEARXNG_API_BASE" in your environment variables.`)
        }

        if (params) {
            this.params = { ...this.params, ...params }
        }

        if (toolName) {
            this.name = toolName
        }

        if (toolDescription) {
            this.description = toolDescription
        }
    }

    protected buildUrl<P extends SearxngSearchParams>(path: string, parameters: P, baseUrl: string): string {
        const nonUndefinedParams: [string, string][] = Object.entries(parameters)
            .filter(([_, value]) => value !== undefined)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Set SEARXNG_API_BASE in the Flowise server environment (e.g. export SEARXNG_API_BASE=https://search.example.com).
  2. Pass `apiBase` explicitly when constructing the tool.
  3. In the Searxng node config, fill the API base field with the full URL to the SearxNG instance.
  4. Restart the Flowise process after setting the env var.

Example fix

// before
const tool = new SearxngTool({} as any) // throws: SEARXNG_API_BASE not set

// after
process.env.SEARXNG_API_BASE = 'https://search.example.com'
// or pass explicitly:
const tool = new SearxngTool({ apiBase: 'https://search.example.com' })
Defensive patterns

Strategy: validation

Validate before calling

function buildSearxngTool(overrides: Record<string, unknown> = {}) {
  const apiBase = overrides.apiBase ?? process.env.SEARXNG_API_BASE
  if (!apiBase || !/^https?:\/\//.test(apiBase)) {
    throw new Error('SEARXNG_API_BASE missing or invalid — set it in the environment or pass apiBase')
  }
  return new SearxngTool({ apiBase, ...overrides } as any)
}

Type guard

const hasSearxngBase = (env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { SEARXNG_API_BASE: string } =>
  typeof env.SEARXNG_API_BASE === 'string' && /^https?:\/\//.test(env.SEARXNG_API_BASE)

Try / catch

try {
  return buildSearxngTool({ apiBase })
} catch (e) {
  if (/SEARXNG_API_BASE not set/.test((e as Error).message)) {
    throw new Error('Searxng unavailable: configure SEARXNG_API_BASE in Flowise server env')
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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