Mintplex-Labs/anything-llm · error · Error
No SambaNova API key was set.
Error message
No SambaNova API key was set.
What it means
Thrown by the SambaNovaLLM constructor when process.env.SAMBANOVA_LLM_API_KEY is falsy. SambaNova exposes an OpenAI-compatible endpoint at https://api.sambanova.ai/v1 and the constructor builds the client inline, so it fails fast without a key.
Source
Thrown at server/utils/AiProviders/sambanova/index.js:16
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const { isAbortError } = require("../../helpers/abortSignals");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const { v4: uuidv4 } = require("uuid");
const {
writeResponseChunk,
clientAbortedHandler,
} = require("../../helpers/chat/responses");
const { MODEL_MAP } = require("../modelMap");
class SambaNovaLLM {
constructor(embedder = null, modelPreference = null) {
if (!process.env.SAMBANOVA_LLM_API_KEY)
throw new Error("No SambaNova API key was set.");
this.className = "SambaNovaLLM";
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
baseURL: "https://api.sambanova.ai/v1",
apiKey: process.env.SAMBANOVA_LLM_API_KEY,
});
this.model = modelPreference || process.env.SAMBANOVA_LLM_MODEL_PREF;
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
user: this.promptWindowLimit() * 0.7,
};
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
this.log(
`Initialized ${this.model} with context window ${this.promptWindowLimit()}`View on GitHub (pinned to 526360e320)
Solutions
- Generate a key in the SambaNova dashboard and set SAMBANOVA_LLM_API_KEY in server/.env, then restart.
- Verify with `node -e "console.log(Boolean(process.env.SAMBANOVA_LLM_API_KEY))"` under the same env.
- Pass the variable through in Docker (env_file / environment) and recreate the container.
- Remove any surrounding quotes/whitespace.
Example fix
// before // SAMBANOVA_LLM_API_KEY unset -> throws const llm = new SambaNovaLLM(embedder, "Meta-Llama-3.1-70B-Instruct"); // after // server/.env // SAMBANOVA_LLM_API_KEY=<key from sambanova.ai> const llm = new SambaNovaLLM(embedder, "Meta-Llama-3.1-70B-Instruct");
Defensive patterns
Strategy: validation
Validate before calling
function assertSambanovaKey() {
if (!process.env.SAMBANOVA_LLM_API_KEY || !process.env.SAMBANOVA_LLM_API_KEY.trim()) {
throw new Error("SAMBANOVA_LLM_API_KEY is missing — create one in the SambaNova console");
}
}
assertSambanovaKey();
const llm = new SambaNovaLLM(embedder, modelPref); Type guard
function hasSambanovaKey(env = process.env) {
return typeof env.SAMBANOVA_LLM_API_KEY === "string" && env.SAMBANOVA_LLM_API_KEY.trim().length > 0;
} Try / catch
let llm;
try {
llm = new SambaNovaLLM(embedder, modelPref);
} catch (e) {
if (/No SambaNova API key/i.test(e.message)) {
return { ok: false, reason: "missing-sambanova-key" };
}
throw e;
} Prevention
- Validate all provider keys at boot and report missing ones in one message.
- Use the exact name SAMBANOVA_LLM_API_KEY (note the _LLM segment) — a common typo is SAMBANOVA_API_KEY.
- Restart the process after adding the variable.
- Confirm the key is authorised for the model on the SambaNova console, since SambaNova gates models per tenant.
When it happens
Trigger: Calling `new SambaNovaLLM(...)` while SAMBANOVA_LLM_API_KEY is unset or empty. Selecting SambaNova in the UI before provisioning a key at sambanova.ai, or running the server with the variable missing.
Common situations: New SambaNova integration where the API key was not yet created in the SambaNova console; variable named SAMBANOVA_API_KEY instead of SAMBANOVA_LLM_API_KEY; .env updated but server not restarted; container env not refreshed.
Related errors
- No Perplexity API key was set.
- No PPIO API key was set.
- No TogetherAI API key was set.
- No Minimax API key was set.
- No Mistral API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/f326b48cbd372edb.
Report an issue: GitHub.