{"record":{"id":"ff039c7a675ce518","repo":"Mintplex-Labs/anything-llm","slug":"no-fireworksai-api-key-was-set","errorCode":null,"errorMessage":"No FireworksAI API key was set.","messagePattern":"No FireworksAI API key was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/AiProviders/fireworksAi/index.js","lineNumber":23,"sourceCode":"const {\n  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst {\n  handleDefaultStreamResponseV2,\n} = require(\"../../helpers/chat/responses\");\n\nconst cacheFolder = path.resolve(\n  process.env.STORAGE_DIR\n    ? path.resolve(process.env.STORAGE_DIR, \"models\", \"fireworks\")\n    : path.resolve(__dirname, `../../../storage/models/fireworks`)\n);\n\nclass FireworksAiLLM {\n  constructor(embedder = null, modelPreference = null) {\n    this.className = \"FireworksAiLLM\";\n\n    if (!process.env.FIREWORKS_AI_LLM_API_KEY)\n      throw new Error(\"No FireworksAI API key was set.\");\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.openai = new OpenAIApi({\n      baseURL: \"https://api.fireworks.ai/inference/v1\",\n      apiKey: process.env.FIREWORKS_AI_LLM_API_KEY ?? null,\n    });\n    this.model = modelPreference || process.env.FIREWORKS_AI_LLM_MODEL_PREF;\n    this.limits = {\n      history: this.promptWindowLimit() * 0.15,\n      system: this.promptWindowLimit() * 0.15,\n      user: this.promptWindowLimit() * 0.7,\n    };\n\n    this.embedder = !embedder ? new NativeEmbedder() : embedder;\n    this.defaultTemp = 0.7;\n\n    if (!fs.existsSync(cacheFolder))\n      fs.mkdirSync(cacheFolder, { recursive: true });\n    this.cacheModelPath = path.resolve(cacheFolder, \"models.json\");","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/fireworksAi/index.js#L5-L41","documentation":"Constructor guard that prevents FireworksAiLLM instantiation when FIREWORKS_AI_LLM_API_KEY is missing. The key authenticates the OpenAI-compatible client at https://api.fireworks.ai/inference/v1. Without it the client cannot make inference calls, so the class aborts at construction.","triggerScenarios":"Instantiating `new FireworksAiLLM()` with FIREWORKS_AI_LLM_API_KEY unset or empty; selecting FireworksAI as the provider without saving a key; env var name typo.","commonSituations":"Fresh deployment selecting FireworksAI without entering a key; .env missing the key after migration; key revoked on the Fireworks AI dashboard; CI environment without the key injected.","solutions":["Set FIREWORKS_AI_LLM_API_KEY in .env to a valid key from fireworks.ai/account/api-keys.","Restart the server to load the new env var.","Re-enter the key in the AnythingLLM FireworksAI provider settings and save."],"exampleFix":"# .env\nFIREWORKS_AI_LLM_API_KEY=fw-your-fireworks-key-here","handlingStrategy":"validation","validationCode":"const FW_KEY = process.env.FIREWORKS_AI_LLM_API_KEY;\nif (!FW_KEY || FW_KEY.trim() === '')\n  throw new Error('FIREWORKS_AI_LLM_API_KEY must be set before using the FireworksAI provider');","typeGuard":null,"tryCatchPattern":"try {\n  provider = new FireworksAiLLM(embedder, modelPref);\n} catch (e) {\n  if (/No FireworksAI API key/i.test(e.message))\n    return respondConfigError('Set FIREWORKS_AI_LLM_API_KEY in the FireworksAI provider settings.');\n  throw e;\n}","preventionTips":["Store the key in .env and verify dotenv loads it on startup.","Run a provider env-var health check on boot.","Re-enter the key in the UI after any rotation."],"tags":["fireworks-ai","missing-api-key","constructor-guard","env-var"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}