Mintplex-Labs/anything-llm · critical · Error
No Azure API key was set.
Error message
No Azure API key was set.
What it means
Thrown in the AzureOpenAiEmbedder constructor when AZURE_OPENAI_KEY is falsy, immediately after the endpoint check passes. Without the key the AzureOpenAI client cannot authenticate to the embeddings deployment.
Source
Thrown at server/utils/EmbeddingEngines/azureOpenAi/index.js:9
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
this.maxConcurrentChunks = 16;
View on GitHub (pinned to 526360e320)
Solutions
- Set AZURE_OPENAI_KEY to a valid key from the Azure OpenAI resource (Keys and Endpoint pane).
- Ensure AZURE_OPENAI_ENDPOINT is also set (the prior check).
- Restart the server after setting the var.
- If using keyless/Entra auth, note this embedder path requires the static key; switch to the appropriate provider or supply the key.
Defensive patterns
Strategy: validation
Validate before calling
function assertAzureEmbedKey() {
if (!process.env.AZURE_OPENAI_KEY) {
throw new Error('Missing env AZURE_OPENAI_KEY');
}
}
assertAzureEmbedKey(); Try / catch
try {
new AzureOpenAiEmbedder();
} catch (e) {
if (/key/i.test(e.message) && /azure/i.test(e.message)) { /* prompt for AZURE_OPENAI_KEY */ }
throw e;
} Prevention
- Copy both Key1/Key2 from the Azure resource, not just the endpoint.
- This embedder requires a static key — Entra/managed identity is not supported here.
- Restart after rotating the key.
When it happens
Trigger: AZURE_OPENAI_ENDPOINT is set but AZURE_OPENAI_KEY is missing/empty; key stored under a different env name; key rotated in Azure but not redeployed.
Common situations: Copying the endpoint from the portal but not the key; using KEY_VAULT/managed identity without updating this constructor; AAD/Microsoft Entra auth intended but the code still requires the static key.
Related errors
- No Azure API endpoint was set.
- No Cohere API key was set.
- No Gemini API key was set.
- No xAI API key was set.
- No Z.AI API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/743be0657d078683.
Report an issue: GitHub.