{"record":{"id":"fedcd3a6094a606d","repo":"Mintplex-Labs/anything-llm","slug":"no-nvidia-nim-api-base-path-was-set","errorCode":null,"errorMessage":"No NVIDIA NIM API Base Path was set.","messagePattern":"No NVIDIA NIM API Base Path was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/AiProviders/nvidiaNim/index.js","lineNumber":13,"sourceCode":"const { NativeEmbedder } = require(\"../../EmbeddingEngines/native\");\nconst {\n  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst {\n  handleDefaultStreamResponseV2,\n  formatChatHistory,\n} = require(\"../../helpers/chat/responses\");\n\nclass NvidiaNimLLM {\n  constructor(embedder = null, modelPreference = null) {\n    if (!process.env.NVIDIA_NIM_LLM_BASE_PATH)\n      throw new Error(\"No NVIDIA NIM API Base Path was set.\");\n\n    this.className = \"NvidiaNimLLM\";\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.nvidiaNim = new OpenAIApi({\n      baseURL: parseNvidiaNimBasePath(process.env.NVIDIA_NIM_LLM_BASE_PATH),\n      apiKey: null,\n    });\n\n    this.model = modelPreference || process.env.NVIDIA_NIM_LLM_MODEL_PREF;\n    this.limits = {\n      history: this.promptWindowLimit() * 0.15,\n      system: this.promptWindowLimit() * 0.15,\n      user: this.promptWindowLimit() * 0.7,\n    };\n\n    this.embedder = embedder ?? new NativeEmbedder();\n    this.defaultTemp = 0.7;\n    this.#log(","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/nvidiaNim/index.js#L1-L31","documentation":"Constructor guard for NvidiaNimLLM: throws if process.env.NVIDIA_NIM_LLM_BASE_PATH is absent. Unlike cloud providers, NIM is self-hosted and uses apiKey: null — authentication is handled by the endpoint itself, so the only required config is the base path (parsed by parseNvidiaNimBasePath). Without it the adapter cannot be built.","triggerScenarios":"Instantiating `new NvidiaNimLLM(...)` without NVIDIA_NIM_LLM_BASE_PATH set — i.e. selecting the NVIDIA NIM provider without pointing it at a running NIM endpoint.","commonSituations":"First-time self-hosted NIM setup; NIM endpoint moved port/host; env var not propagated to the container; .env typo (e.g. NVIDIA_NIM_BASE_PATH without _LLM).","solutions":["Set NVIDIA_NIM_LLM_BASE_PATH to the NIM endpoint URL (e.g. http://host:8000/v1).","Confirm the endpoint is reachable from the AnythingLLM process (network/firewall).","Restart the server to reload env.","Verify parseNvidiaNimBasePath accepts your URL format."],"exampleFix":"// server/.env\nNVIDIA_NIM_LLM_BASE_PATH=http://localhost:8000/v1\nNVIDIA_NIM_LLM_MODEL_PREF=meta/llama-3.1-8b-instruct","handlingStrategy":"validation","validationCode":"if (!process.env.NVIDIA_NIM_LLM_BASE_PATH) {\n  throw new Error('NVIDIA_NIM_LLM_BASE_PATH missing — point it at your self-hosted NIM endpoint.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const llm = new NvidiaNimLLM(embedder, modelPref);\n} catch (e) {\n  if (/No NVIDIA NIM API Base Path/i.test(e.message)) {\n    // config error — set the NIM endpoint URL\n  }\n}","preventionTips":["Treat NIM base path as required infra config — validate it in the provider factory.","Confirm endpoint reachability from the app host (firewall/DNS).","Document the expected URL form (scheme://host:port[/v1])."],"tags":["nvidia-nim","configuration","self-hosted","base-path","env","constructor"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}