{"record":{"id":"a8c608e82c6c50ef","repo":"Mintplex-Labs/anything-llm","slug":"mistral-api-key-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"Mistral API key must be provided to use agents.","messagePattern":"Mistral API key must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/index.js","lineNumber":178,"sourceCode":"      case \"koboldcpp\":\n        if (!process.env.KOBOLD_CPP_BASE_PATH)\n          throw new Error(\n            \"KoboldCPP must have a valid base path to use for the api.\"\n          );\n        break;\n      case \"localai\":\n        if (!process.env.LOCAL_AI_BASE_PATH)\n          throw new Error(\n            \"LocalAI must have a valid base path to use for the api.\"\n          );\n        break;\n      case \"openrouter\":\n        if (!process.env.OPENROUTER_API_KEY)\n          throw new Error(\"OpenRouter API key must be provided to use agents.\");\n        break;\n      case \"mistral\":\n        if (!process.env.MISTRAL_API_KEY)\n          throw new Error(\"Mistral API key must be provided to use agents.\");\n        break;\n      case \"generic-openai\":\n        if (!process.env.GENERIC_OPEN_AI_BASE_PATH)\n          throw new Error(\"API base path must be provided to use agents.\");\n        break;\n      case \"perplexity\":\n        if (!process.env.PERPLEXITY_API_KEY)\n          throw new Error(\"Perplexity API key must be provided to use agents.\");\n        break;\n      case \"textgenwebui\":\n        if (!process.env.TEXT_GEN_WEB_UI_BASE_PATH)\n          throw new Error(\n            \"TextWebGenUI API base path must be provided to use agents.\"\n          );\n        break;\n      case \"bedrock\":\n        // No validations since there are many possible authentication methods\n        break;","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L160-L196","documentation":"Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:177) when the workspace agent provider is 'mistral' but MISTRAL_API_KEY is unset/empty. Mistral AI exposes its La Plateforme API behind this single key, so AnythingLLM validates it before building the agent session.","triggerScenarios":"An agent invocation runs with workspace.agentProvider === 'mistral' while MISTRAL_API_KEY is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.","commonSituations":"Mistral chosen in System > LLM Preference without a key; key generated at console.mistral.ai but never pasted into .env; .env edited on disk while the Node process kept the old env; key revoked after a quota/security rotation.","solutions":["Create an API key at https://console.mistral.ai/api-keys and set MISTRAL_API_KEY in .env.","Restart AnythingLLM to reload process.env.","Validate the key with curl -H 'Authorization: Bearer $MISTRAL_API_KEY' https://api.mistral.ai/v1/models.","Ensure the workspace's agent model is one your Mistral plan allows."],"exampleFix":"// before (.env)\n// MISTRAL_API_KEY=\n\n// after (.env)\nMISTRAL_API_KEY=...your-mistral-key","handlingStrategy":"validation","validationCode":"const key = process.env.MISTRAL_API_KEY;\nif (!key) {\n  throw new Error(\n    'Cannot start Mistral agent: set MISTRAL_API_KEY (from console.mistral.ai/api-keys) in .env.'\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agentHandler.start();\n} catch (e) {\n  if (/Mistral API key must be provided/.test(e.message)) {\n    return respondConfigError('mistral', ['MISTRAL_API_KEY']);\n  }\n  throw e;\n}","preventionTips":["Generate the key in Mistral console and paste it into .env in the same step.","Restart the Node process / Docker container after editing .env.","Add a startup config validator that maps each provider to its required env vars.","Treat .env as a secret; restrict file permissions and exclude from VCS."],"tags":["agents","llm-provider","mistral","api-key","environment-variables","config"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}