{"record":{"id":"889da5647cd74952","repo":"FlowiseAI/Flowise","slug":"firecrawl-query-is-required-for-search-mode","errorCode":null,"errorMessage":"Firecrawl: Query is required for search mode","messagePattern":"Firecrawl: Query is required for search mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/FireCrawl/FireCrawl.ts","lineNumber":581,"sourceCode":"        if (!apiKey) {\n            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.')\n        }\n\n        this.apiKey = apiKey\n        this.url = url\n        this.query = query\n        this.mode = mode\n        this.params = params\n        this.apiUrl = apiUrl || 'https://api.firecrawl.dev'\n    }\n\n    public async load(): Promise<DocumentInterface[]> {\n        const app = new FirecrawlApp({ apiKey: this.apiKey, apiUrl: this.apiUrl })\n        let firecrawlDocs: FirecrawlDocument[]\n\n        if (this.mode === 'search') {\n            if (!this.query) {\n                throw new Error('Firecrawl: Query is required for search mode')\n            }\n            const response = await app.search({ query: this.query, ...this.params })\n            if (!response.success) {\n                throw new Error(`Firecrawl: Failed to search. Warning: ${response.warning}`)\n            }\n\n            // Convert search results to FirecrawlDocument format\n            firecrawlDocs = (response.data || []).map((result) => ({\n                markdown: result.description,\n                metadata: {\n                    title: result.title,\n                    sourceURL: result.url,\n                    description: result.description\n                }\n            }))\n        } else if (this.mode === 'scrape') {\n            if (!this.url) {\n                throw new Error('Firecrawl: URL is required for scrape mode')","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/FireCrawl/FireCrawl.ts#L563-L599","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a non-empty query in the loader params.","Validate the upstream value before switching the node to search mode.","Default query to a sane fallback in your orchestration layer.","Check that template variables like {{$flow.input}} resolve to text."],"exampleFix":"// before\nnew FireCrawlLoader({ apiKey, mode: 'search' }).load()\n\n// after\nconst query = (inputQuery || '').trim()\nif (!query) throw new Error('Search mode requires a non-empty query')\nnew FireCrawlLoader({ apiKey, mode: 'search', query }).load()","handlingStrategy":"validation","validationCode":"const query = (params.query ?? upstreamQuery ?? '').trim()\nif (!query) throw new Error('search mode requires a non-empty query')\nnew FireCrawlLoader({ ...params, mode: 'search', query })","typeGuard":"function hasQuery(p: FirecrawlLoaderParameters): p is FirecrawlLoaderParameters & { query: string } {\n  return typeof p.query === 'string' && p.query.trim().length > 0\n}","tryCatchPattern":"try { await loader.load() }\ncatch (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 }","preventionTips":["Validate the upstream node emits a non-empty query before switching to search mode.","Add a default query in the orchestration layer.","Surface a UI hint that search mode requires the query field."],"tags":["firecrawl","validation","search","loader","config"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}