Mintplex-Labs/anything-llm · critical · Error

No Azure API endpoint was set.

Error message

No Azure API endpoint was set.

What it means

Thrown in the AzureOpenAiEmbedder constructor when process.env.AZURE_OPENAI_ENDPOINT is falsy, before the AzureOpenAI client is built. The endpoint is the Azure resource URL (e.g. https://<resource>.cognitiveservices.azure.com/), distinct from the key and the deployment name.

Source

Thrown at server/utils/EmbeddingEngines/azureOpenAi/index.js:7

const { toChunks, reportEmbeddingProgress } = require("../../helpers");

class AzureOpenAiEmbedder {
  constructor() {
    const { AzureOpenAI } = 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 = "AzureOpenAiEmbedder";
    this.apiVersion = "2024-12-01-preview";
    const openai = new AzureOpenAI({
      apiKey: process.env.AZURE_OPENAI_KEY,
      endpoint: process.env.AZURE_OPENAI_ENDPOINT,
      apiVersion: this.apiVersion,
    });

    // We cannot assume the model fallback since the model is based on the deployment name
    // and not the model name - so this will throw on embedding if the model is not defined.
    this.model = process.env.EMBEDDING_MODEL_PREF;
    this.openai = openai;

    // Limit of how many strings we can process in a single pass to stay with resource or network limits
    // https://learn.microsoft.com/en-us/azure/ai-services/openai/faq#i-am-trying-to-use-embeddings-and-received-the-error--invalidrequesterror--too-many-inputs--the-max-number-of-inputs-is-1---how-do-i-fix-this-:~:text=consisting%20of%20up%20to%2016%20inputs%20per%20API%20request

View on GitHub (pinned to 526360e320)

Solutions

  1. Set AZURE_OPENAI_ENDPOINT to your Azure OpenAI resource endpoint (https://<resource-name>.cognitiveservices.azure.com/).
  2. Also set AZURE_OPENAI_KEY (checked next) and EMBEDDING_MODEL_PREF to the deployment name.
  3. Restart the process after editing .env so the var loads.
  4. Confirm the endpoint is the Azure resource URL, not api.openai.com.
Defensive patterns

Strategy: validation

Validate before calling

function assertAzureEmbedEnv() {
  if (!process.env.AZURE_OPENAI_ENDPOINT) {
    throw new Error('Missing env AZURE_OPENAI_ENDPOINT (Azure OpenAI resource URL)');
  }
}
assertAzureEmbedEnv();

Type guard

/** @param {string} url */
function isAzureEndpoint(url) {
  return /^https:\/\/[a-z0-9-]+\.cognitiveservices\.azure\.com\/?/i.test(url || '');
}

Try / catch

try {
  new AzureOpenAiEmbedder();
} catch (e) {
  if (/endpoint/i.test(e.message)) { /* prompt for AZURE_OPENAI_ENDPOINT */ }
  throw e;
}

Prevention

When it happens

Trigger: Constructing the Azure OpenAI embedder while AZURE_OPENAI_ENDPOINT is unset/empty; pointing it at the wrong base URL; selecting the Azure embedding engine in config before provisioning the resource.

Common situations: Confusing AZURE_OPENAI_ENDPOINT with AZURE_OPENAI_KEY or with the deployment name; copying only the key from the Azure portal; using the generic OpenAI endpoint instead of the Azure resource endpoint; env var not propagated to the worker.

Related errors


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