Mintplex-Labs/anything-llm · error · Error

No NVIDIA NIM API Base Path was set.

Error message

No NVIDIA NIM API Base Path was set.

What it means

NvidiaNimLLM's constructor throws when process.env.NVIDIA_NIM_LLM_BASE_PATH is falsy. The base path (parsed via parseNvidiaNimBasePath) points at a self-hosted NVIDIA NIM inference server's OpenAI-compatible endpoint, and without it there is no endpoint to build the client against, so the provider cannot be constructed at all.

Solutions

  1. Set NVIDIA_NIM_LLM_BASE_PATH to the NIM server endpoint, e.g. http://localhost:8000/v1
  2. Restart the AnythingLLM server or container
  3. Verify the NIM server is up: curl http://localhost:8000/v1/models
  4. In Docker, ensure the variable (and host networking if NIM runs locally) is configured

Example fix

# before
# (NVIDIA_NIM_LLM_BASE_PATH not set)
# after
NVIDIA_NIM_LLM_BASE_PATH=http://localhost:8000/v1
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.NVIDIA_NIM_LLM_BASE_PATH)
  throw new Error('NVIDIA NIM selected but NVIDIA_NIM_LLM_BASE_PATH is not configured');
const llm = new NvidiaNimLLM(embedder);

Try / catch

try {
  const llm = new NvidiaNimLLM(embedder);
} catch (e) {
  if (e.message === 'No NVIDIA NIM API Base Path was set.')
    return respondConfigError(e); // set base path, restart, do not retry
  throw e;
}

Prevention

When it happens

Trigger: Selecting NVIDIA NIM as the LLM provider with NVIDIA_NIM_LLM_BASE_PATH unset, empty, or typo'd; .env edited but the server not restarted; Docker deployments where the variable was not passed in.

Common situations: NIM container reachable but the env var never configured; variable name typos (NVIDIA_NIM_BASE_PATH, NIM_LLM_BASE_PATH); forgetting that env changes require a restart.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/fedcd3a6094a606d. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/AiProviders/nvidiaNim/index.js:13

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

class NvidiaNimLLM {
  constructor(embedder = null, modelPreference = null) {
    if (!process.env.NVIDIA_NIM_LLM_BASE_PATH)
      throw new Error("No NVIDIA NIM API Base Path was set.");

    this.className = "NvidiaNimLLM";
    const { OpenAI: OpenAIApi } = require("openai");
    this.nvidiaNim = new OpenAIApi({
      baseURL: parseNvidiaNimBasePath(process.env.NVIDIA_NIM_LLM_BASE_PATH),
      apiKey: null,
    });

    this.model = modelPreference || process.env.NVIDIA_NIM_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 3aec848f28)