FlowiseAI/Flowise · critical · Error

Fireworks API key not found. Please set the FIREWORKS_API_KE

Error message

Fireworks API key not found. Please set the FIREWORKS_API_KEY environment variable or provide the key into "fireworksApiKey"

What it means

Thrown by the ChatFireworks constructor (core.ts:56) when none of fields.apiKey, fields.fireworksApiKey, or the FIREWORKS_API_KEY environment variable resolve to a truthy value. ChatFireworks extends the LangChain OpenAI completions client and hard-codes the Fireworks baseURL; it requires the key at construction time. The constructor is synchronous, so this throws at `new ChatFireworks(...)`.

Source

Thrown at packages/components/nodes/chatmodels/ChatFireworks/core.ts:56

    get lc_secrets(): { [key: string]: string } | undefined {
        return {
            fireworksApiKey: 'FIREWORKS_API_KEY',
            apiKey: 'FIREWORKS_API_KEY'
        }
    }

    lc_serializable = true

    fireworksApiKey?: string

    apiKey?: string

    constructor(fields?: ChatFireworksParams) {
        const fireworksApiKey = fields?.apiKey || fields?.fireworksApiKey || getEnvironmentVariable('FIREWORKS_API_KEY')

        if (!fireworksApiKey) {
            throw new Error(
                `Fireworks API key not found. Please set the FIREWORKS_API_KEY environment variable or provide the key into "fireworksApiKey"`
            )
        }

        super({
            ...fields,
            model: fields?.model || fields?.modelName || 'accounts/fireworks/models/llama-v3p1-8b-instruct',
            apiKey: fireworksApiKey,
            configuration: {
                baseURL: 'https://api.fireworks.ai/inference/v1'
            },
            streamUsage: false
        })

        this.fireworksApiKey = fireworksApiKey
        this.apiKey = fireworksApiKey
    }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Add FIREWORKS_API_KEY=<your-key> to the Flowise .env file and restart the process so getEnvironmentVariable picks it up.
  2. Pass the key explicitly: new ChatFireworks({ apiKey: process.env.FIREWORKS_API_KEY }).
  3. In Flowise, verify the Fireworks credential component is bound to the node so the key is injected at construction.

Example fix

// before: new ChatFireworks({ model: 'accounts/fireworks/models/llama-v3p1-8b-instruct' })  // FIREWORKS_API_KEY unset -> throws
// after:  new ChatFireworks({ apiKey: process.env.FIREWORKS_API_KEY, model: 'accounts/fireworks/models/llama-v3p1-8b-instruct' })
Defensive patterns

Strategy: validation

Validate before calling

function resolveFireworksKey(fields?: { apiKey?: string; fireworksApiKey?: string }): string {
  const key = fields?.apiKey || fields?.fireworksApiKey || process.env.FIREWORKS_API_KEY
  if (!key) throw new Error('Set FIREWORKS_API_KEY or pass apiKey/fireworksApiKey')
  return key
}
// guard before construction:
const apiKey = resolveFireworksKey({ apiKey: process.env.FIREWORKS_API_KEY })
new ChatFireworks({ apiKey })

Type guard

function hasFireworksKey(fields: unknown): fields is { apiKey: string } | { fireworksApiKey: string } {
  return typeof fields === 'object' && fields !== null
    && (typeof (fields as any).apiKey === 'string' || typeof (fields as any).fireworksApiKey === 'string')
}

Try / catch

try {
  return new ChatFireworks(params)
} catch (e) {
  if (e instanceof Error && /Fireworks API key not found/.test(e.message)) {
    // instruct the user to set FIREWORKS_API_KEY in .env and restart
  }
  throw e
}

Prevention

When it happens

Trigger: Instantiating ChatFireworks without passing apiKey/fireworksApiKey in the fields object while FIREWORKS_API_KEY is unset in the process environment.

Common situations: The FIREWORKS_API_KEY env var was never added to .env (or Flowise was not restarted after editing .env), the key was removed, or code constructs the class directly without forwarding credentials.

Related errors


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