Mintplex-Labs/anything-llm · error · Error

Azure OpenAI API endpoint and key must be provided to use…

Error message

Azure OpenAI API endpoint and key must be provided to use agents.

What it means

Setup guard in checkSetup(): provider is 'azure' but either AZURE_OPENAI_ENDPOINT or AZURE_OPENAI_KEY is missing. Azure OpenAI requires both the deployed resource endpoint and its key, so agent setup is aborted until both are set.

Solutions

  1. Set the AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_KEY environment variables.
  2. Or select a different agent provider.
Defensive patterns

Strategy: validation

When it happens

Trigger: Azure OpenAI was selected as the agent provider but endpoint or key is missing.

Common situations: This error is raised at runtime in server/utils/agents/index.js. It occurs when the required configuration for this provider is missing or invalid (unset environment variables, empty API key or base path), when the external service is unreachable or returns an unexpected response, or when invalid input reaches the call site. To prevent it, validate the relevant provider settings and environment variables at startup and confirm the service is reachable before this code path executes.


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/a227a1f029cdee25. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/agents/index.js:156

      case "lmstudio":
        if (!process.env.LMSTUDIO_BASE_PATH)
          throw new Error("LMStudio base path must be provided to use agents.");
        break;
      case "ollama":
        if (!process.env.OLLAMA_BASE_PATH)
          throw new Error("Ollama base path must be provided to use agents.");
        break;
      case "groq":
        if (!process.env.GROQ_API_KEY)
          throw new Error("Groq API key must be provided to use agents.");
        break;
      case "togetherai":
        if (!process.env.TOGETHER_AI_API_KEY)
          throw new Error("TogetherAI API key must be provided to use agents.");
        break;
      case "azure":
        if (!process.env.AZURE_OPENAI_ENDPOINT || !process.env.AZURE_OPENAI_KEY)
          throw new Error(
            "Azure OpenAI API endpoint and key must be provided to use agents."
          );
        break;
      case "koboldcpp":
        if (!process.env.KOBOLD_CPP_BASE_PATH)
          throw new Error(
            "KoboldCPP must have a valid base path to use for the api."
          );
        break;
      case "localai":
        if (!process.env.LOCAL_AI_BASE_PATH)
          throw new Error(
            "LocalAI must have a valid base path to use for the api."
          );
        break;
      case "openrouter":
        if (!process.env.OPENROUTER_API_KEY)
          throw new Error("OpenRouter API key must be provided to use agents.");

View on GitHub (pinned to 20f6d3546c)