Mintplex-Labs/anything-llm · critical · Error

No Azure API endpoint was set.

Error message

No Azure API endpoint was set.

What it means

Thrown by the AzureOpenAiLLM constructor when process.env.AZURE_OPENAI_ENDPOINT is falsy. Azure OpenAI requires an endpoint URL (per-resource) distinct from the key, and formatBaseUrl later parses it, so the constructor gates on its presence before anything else. It is checked before the key guard, so this fires first when both are missing.

Source

Thrown at server/utils/AiProviders/azureOpenAi/index.js:14

const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
  formatChatHistory,
  handleDefaultStreamResponseV2,
} = require("../../helpers/chat/responses");
const {
  LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");

class AzureOpenAiLLM {
  constructor(embedder = null, modelPreference = null) {
    const { OpenAI } = require("openai");
    if (!process.env.AZURE_OPENAI_ENDPOINT)
      throw new Error("No Azure API endpoint was set.");
    if (!process.env.AZURE_OPENAI_KEY)
      throw new Error("No Azure API key was set.");

    this.className = "AzureOpenAiLLM";
    this.openai = new OpenAI({
      apiKey: process.env.AZURE_OPENAI_KEY,
      baseURL: AzureOpenAiLLM.formatBaseUrl(process.env.AZURE_OPENAI_ENDPOINT),
    });
    this.model =
      modelPreference ||
      process.env.AZURE_OPENAI_MODEL_PREF ||
      process.env.OPEN_MODEL_PREF;
    /* 
      Note: Azure OpenAI deployments do not expose model metadata that would allow us to
      programmatically detect whether the deployment uses a reasoning model (o1, o1-mini, o3-mini, etc.).
      As a result, we rely on the user to explicitly set AZURE_OPENAI_MODEL_TYPE="reasoning"
      when using reasoning models, as incorrect configuration might result in chat errors.
    */

View on GitHub (pinned to 526360e320)

Solutions

  1. Set `AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com` in .env and restart.
  2. Re-save the Azure provider config in the UI so both endpoint and key are persisted.
  3. Confirm the variable name exactly matches AZURE_OPENAI_ENDPOINT (no typo like ENDPOINT_URL).
  4. Also set AZURE_OPENAI_KEY to avoid immediately hitting the next guard (error 167).

Example fix

// before
// .env
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_KEY=...

// after
// .env
AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com
AZURE_OPENAI_KEY=...
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.AZURE_OPENAI_ENDPOINT) {
  throw new Error(
    "AZURE_OPENAI_ENDPOINT is missing. Set it to https://<resource>.openai.azure.com before using Azure."
  );
}
const llm = new AzureOpenAiLLM(embedder, modelPref);

Type guard

/** @param {unknown} v @returns {boolean} */
function isNonEmptyString(v) {
  return typeof v === "string" && v.trim().length > 0;
}

Try / catch

try {
  const llm = new AzureOpenAiLLM(embedder, modelPref);
} catch (e) {
  if (/No Azure API endpoint/.test(e.message)) {
    return { ok: false, reason: "missing-endpoint" };
  }
  throw e;
}

Prevention

When it happens

Trigger: Instantiating AzureOpenAiLLM while AZURE_OPENAI_ENDPOINT is unset. The value should look like `https://<resource>.openai.azure.com` and is later normalized to `<endpoint>/openai/v1` by formatBaseUrl.

Common situations: Azure provider selected but endpoint not pasted; key was set but endpoint field left blank; env var misnamed (e.g. AZURE_OPENAI_URL); deploying to a new environment without copying the endpoint.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/17fa92b1b4aa2107. Report an issue: GitHub.