Mintplex-Labs/anything-llm · error · Error
No Privatemode Base Path was set.
Error message
No Privatemode Base Path was set.
What it means
Thrown by the PrivatemodeLLM constructor when process.env.PRIVATEMODE_LLM_BASE_PATH is falsy. Privatemode is a self-hosted/local OpenAI-compatible server, so its base URL is mandatory; there is no default endpoint. The constructor then runs the value through parseBasePath() which appends /v1.
Source
Thrown at server/utils/AiProviders/privatemode/index.js:21
handleDefaultStreamResponseV2,
formatChatHistory,
} = require("../../helpers/chat/responses");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
class PrivatemodeLLM {
static contextWindows = {
"leon-se/gemma-3-27b-it-fp8-dynamic": 128000,
"gemma-3-27b": 128000,
"qwen3-coder-30b-a3b": 128000,
"gpt-oss-120b": 128000,
"openai/gpt-oss-120b": 128000,
};
constructor(embedder = null, modelPreference = null) {
if (!process.env.PRIVATEMODE_LLM_BASE_PATH)
throw new Error("No Privatemode Base Path was set.");
this.className = "PrivatemodeLLM";
const { OpenAI: OpenAIApi } = require("openai");
this.client = new OpenAIApi({
baseURL: PrivatemodeLLM.parseBasePath(),
apiKey: null,
});
this.model = modelPreference || process.env.PRIVATEMODE_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(View on GitHub (pinned to 526360e320)
Solutions
- Set PRIVATEMODE_LLM_BASE_PATH to the Privatemode server origin (e.g. http://127.0.0.1:8000) in server/.env and restart.
- Confirm the Privatemode process is listening: `curl -s http://127.0.0.1:8000/v1/models`.
- If behind Docker networking, use the service name/host reachable from the AnythingLLM container.
- Restart AnythingLLM so the new env is loaded.
Example fix
// before // PRIVATEMODE_LLM_BASE_PATH unset -> throws const llm = new PrivatemodeLLM(embedder, "gemma-3-27b"); // after // server/.env // PRIVATEMODE_LLM_BASE_PATH=http://127.0.0.1:8000 // PRIVATEMODE_LLM_MODEL_PREF=gemma-3-27b const llm = new PrivatemodeLLM(embedder, "gemma-3-27b");
Defensive patterns
Strategy: validation
Validate before calling
function assertPrivatemodeBasePath() {
if (!process.env.PRIVATEMODE_LLM_BASE_PATH || !process.env.PRIVATEMODE_LLM_BASE_PATH.trim()) {
throw new Error("PRIVATEMODE_LLM_BASE_PATH missing — set to your Privatemode server origin (e.g. http://127.0.0.1:8000)");
}
}
assertPrivatemodeBasePath();
const llm = new PrivatemodeLLM(embedder, modelPref); Type guard
function hasPrivatemodeBasePath(env = process.env) {
return typeof env.PRIVATEMODE_LLM_BASE_PATH === "string" && env.PRIVATEMODE_LLM_BASE_PATH.trim().length > 0;
} Try / catch
let llm;
try {
llm = new PrivatemodeLLM(embedder, modelPref);
} catch (e) {
if (/No Privatemode Base Path/i.test(e.message)) {
return { ok: false, reason: "missing-base-path" };
}
throw e;
} Prevention
- Boot-time check that the Privatemode server is reachable (curl <base>/v1/models) before marking the provider ready.
- Document that the value is an origin, not a model id.
- When running AnythingLLM in Docker, use the host/docker-service address rather than 127.0.0.1.
- Restart AnythingLLM after every .env change.
When it happens
Trigger: Instantiating `new PrivatemodeLLM(...)` with PRIVATEMODE_LLM_BASE_PATH unset, empty, or whitespace-only. The variable must be the origin (and optionally path) of the local Privatemode inference server, e.g. http://127.0.0.1:8000.
Common situations: Privatemode container/process not yet started when AnythingLLM boots; the variable was named PRIVATEMODE_BASE_PATH instead of PRIVATEMODE_LLM_BASE_PATH; the env file was not reloaded after adding it; a docker-compose override omitted the mapping.
Related errors
- TextGenWebUI must have a valid base path to use for the api.
- No NVIDIA NIM API Base Path was set.
- No Perplexity API key was set.
- No PPIO API key was set.
- No SambaNova API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/22b4eceb5654accc.
Report an issue: GitHub.