FlowiseAI/Flowise · error · Error
Spider API key not set. You can set it as SPIDER_API_KEY in
Error message
Spider API key not set. You can set it as SPIDER_API_KEY in your .env file, or pass it to Spider.
What it means
Constructor validation in SpiderLoader (LangChain-style BaseDocumentLoader). If no apiKey is passed through loaderParams the object refuses to build, because every subsequent Spider API call requires a Bearer token.
Source
Thrown at packages/components/nodes/documentloaders/Spider/Spider.ts:30
mode?: 'crawl' | 'scrape'
limit?: number
additionalMetadata?: Record<string, unknown>
params?: Record<string, unknown>
}
class SpiderLoader extends BaseDocumentLoader {
private apiKey: string
private url: string
private mode: 'crawl' | 'scrape'
private limit?: number
private additionalMetadata?: Record<string, unknown>
private params?: Record<string, unknown>
constructor(loaderParams: SpiderLoaderParameters) {
super()
const { apiKey, url, mode = 'crawl', limit, additionalMetadata, params } = loaderParams
if (!apiKey) {
throw new Error('Spider API key not set. You can set it as SPIDER_API_KEY in your .env file, or pass it to Spider.')
}
this.apiKey = apiKey
this.url = url
this.mode = mode
this.limit = Number(limit)
this.additionalMetadata = additionalMetadata
this.params = params
}
public async load(): Promise<DocumentInterface[]> {
const app = new SpiderApp({ apiKey: this.apiKey })
let spiderDocs: any[]
if (this.mode === 'scrape') {
const response = await app.scrapeUrl(this.url, this.params)
if (!response.success) {
throw new Error(`Spider: Failed to scrape URL. Error: ${response.error}`)View on GitHub (pinned to abe4a8601a)
Solutions
- Set SPIDER_API_KEY in .env (or the Flowise Spider credential) and restart the process.
- Confirm the credential is wired into the Spider node's credential property, not just a plain input.
- Read the key at construction with fallback: apiKey: process.env.SPIDER_API_KEY || suppliedKey.
- Validate apiKey presence in the node layer before constructing the loader and surface a user-facing message.
Example fix
// before
const loader = new SpiderLoader({ apiKey: inputs.apiKey, url, mode })
// after
const apiKey = inputs.apiKey || process.env.SPIDER_API_KEY
if (!apiKey) throw new Error('Set SPIDER_API_KEY before running this node.')
const loader = new SpiderLoader({ apiKey, url, mode }) Defensive patterns
Strategy: validation
Validate before calling
const apiKey = inputs.apiKey || process.env.SPIDER_API_KEY
if (!apiKey || typeof apiKey !== 'string' || apiKey.trim().length < 10) {
throw new Error('SPIDER_API_KEY missing or too short. Set it in .env or the credential record.')
}
const loader = new SpiderLoader({ apiKey, url, mode }) Type guard
function hasSpiderKey(params: unknown): params is { apiKey: string } {
return typeof (params as any)?.apiKey === 'string' && (params as any).apiKey.length > 0
} Try / catch
try {
new SpiderLoader({ apiKey, url, mode })
} catch (e: any) {
if (/Spider API key not set/.test(e.message)) {
// prompt user to configure credentials
}
throw e
} Prevention
- Centralize credential loading so missing keys fail loudly at startup.
- Wire the Flowise credential component, not a plain text input, for the key.
- Add an env-var presence check in the node's init hook.
- Document the SPIDER_API_KEY env var in the node description.
When it happens
Trigger: Instantiating `new SpiderLoader({ apiKey: undefined, ... })` or `new SpiderLoader({ apiKey: '', ... })`, typically because SPIDER_API_KEY was never set in .env, the credential component did not inject it, or the node wiring passes the wrong variable.
Common situations: Fresh local setup without .env, missing Flowise credential record for Spider, key stored under a different env var name, or a deploy that strips empty-string env values to undefined.
Related errors
- No API key provided
- Model is required
- Invalid Flow State
- Tool not selected
- Firecrawl: Query is required for search mode
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/5c80bb804dab53a8.
Report an issue: GitHub.