FlowiseAI/Flowise · error · Error

Firecrawl: Query is required for search mode

Error message

Firecrawl: Query is required for search mode

What it means

Thrown by FireCrawlLoader.load() when mode === 'search' but no query string was supplied. The loader cannot form a search request without a query, so it fails fast before hitting the network.

Source

Thrown at packages/components/nodes/documentloaders/FireCrawl/FireCrawl.ts:581

        if (!apiKey) {
            throw new Error('Firecrawl API key not set. You can set it as FIRECRAWL_API_KEY in your .env file, or pass it to Firecrawl.')
        }

        this.apiKey = apiKey
        this.url = url
        this.query = query
        this.mode = mode
        this.params = params
        this.apiUrl = apiUrl || 'https://api.firecrawl.dev'
    }

    public async load(): Promise<DocumentInterface[]> {
        const app = new FirecrawlApp({ apiKey: this.apiKey, apiUrl: this.apiUrl })
        let firecrawlDocs: FirecrawlDocument[]

        if (this.mode === 'search') {
            if (!this.query) {
                throw new Error('Firecrawl: Query is required for search mode')
            }
            const response = await app.search({ query: this.query, ...this.params })
            if (!response.success) {
                throw new Error(`Firecrawl: Failed to search. Warning: ${response.warning}`)
            }

            // Convert search results to FirecrawlDocument format
            firecrawlDocs = (response.data || []).map((result) => ({
                markdown: result.description,
                metadata: {
                    title: result.title,
                    sourceURL: result.url,
                    description: result.description
                }
            }))
        } else if (this.mode === 'scrape') {
            if (!this.url) {
                throw new Error('Firecrawl: URL is required for scrape mode')

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Provide a non-empty query in the loader params.
  2. Validate the upstream value before switching the node to search mode.
  3. Default query to a sane fallback in your orchestration layer.
  4. Check that template variables like {{$flow.input}} resolve to text.

Example fix

// before
new FireCrawlLoader({ apiKey, mode: 'search' }).load()

// after
const query = (inputQuery || '').trim()
if (!query) throw new Error('Search mode requires a non-empty query')
new FireCrawlLoader({ apiKey, mode: 'search', query }).load()
Defensive patterns

Strategy: validation

Validate before calling

const query = (params.query ?? upstreamQuery ?? '').trim()
if (!query) throw new Error('search mode requires a non-empty query')
new FireCrawlLoader({ ...params, mode: 'search', query })

Type guard

function hasQuery(p: FirecrawlLoaderParameters): p is FirecrawlLoaderParameters & { query: string } {
  return typeof p.query === 'string' && p.query.trim().length > 0
}

Try / catch

try { await loader.load() }
catch (e) { if (/Query is required for search mode/.test((e as Error).message)) throw new Error('Provide a query input for the search node'); throw e }

Prevention

When it happens

Trigger: new FireCrawlLoader({ apiKey, mode: 'search', query: undefined }) then .load(). Often a Flowise wiring issue where the query input is empty or bound to an upstream node that produced nothing.

Common situations: Query field left blank in the node UI; upstream node emitted empty string; user switched mode to 'search' but did not populate the query field; template variable unresolved.

Related errors


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