{"record":{"id":"babb7b613fe18450","repo":"Mintplex-Labs/anything-llm","slug":"nvidia-nim-base-path-must-be-provided-to-use-agent","errorCode":null,"errorMessage":"NVIDIA NIM base path must be provided to use agents.","messagePattern":"NVIDIA NIM base path must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/index.js","lineNumber":231,"sourceCode":"      case \"apipie\":\n        if (!process.env.APIPIE_LLM_API_KEY)\n          throw new Error(\"ApiPie API Key must be provided to use agents.\");\n        break;\n      case \"xai\":\n        if (!process.env.XAI_LLM_API_KEY)\n          throw new Error(\"xAI API Key must be provided to use agents.\");\n        break;\n      case \"zai\":\n        if (!process.env.ZAI_API_KEY)\n          throw new Error(\"Z.AI API Key must be provided to use agents.\");\n        break;\n      case \"novita\":\n        if (!process.env.NOVITA_LLM_API_KEY)\n          throw new Error(\"Novita API Key must be provided to use agents.\");\n        break;\n      case \"nvidia-nim\":\n        if (!process.env.NVIDIA_NIM_LLM_BASE_PATH)\n          throw new Error(\n            \"NVIDIA NIM base path must be provided to use agents.\"\n          );\n        break;\n      case \"ppio\":\n        if (!process.env.PPIO_API_KEY)\n          throw new Error(\"PPIO API Key must be provided to use agents.\");\n        break;\n      case \"gemini\":\n        if (!process.env.GEMINI_API_KEY)\n          throw new Error(\"Gemini API key must be provided to use agents.\");\n        break;\n      case \"moonshotai\":\n        if (!process.env.MOONSHOT_AI_MODEL_PREF)\n          throw new Error(\"Moonshot AI model must be set to use agents.\");\n        break;\n      case \"cometapi\":\n        if (!process.env.COMETAPI_LLM_API_KEY)\n          throw new Error(\"CometAPI API Key must be provided to use agents.\");","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L213-L249","documentation":"Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:230) when the workspace agent provider is 'nvidia-nim' but NVIDIA_NIM_LLM_BASE_PATH is unset/empty. NVIDIA NIM can be the hosted integrate.api.nvidia.com endpoint or a self-hosted NIM container, so AnythingLLM validates the base URL rather than a key.","triggerScenarios":"An agent invocation runs with workspace.agentProvider === 'nvidia-nim' while NVIDIA_NIM_LLM_BASE_PATH is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.","commonSituations":"NVIDIA NIM selected in System > LLM Preference without an endpoint URL; pointing at a self-hosted NIM container that is not running; .env edited but the server not restarted; using the hosted URL without also setting the NVIDIA key, which will fail later on auth even though this guard passes.","solutions":["Set NVIDIA_NIM_LLM_BASE_PATH in .env to the NIM endpoint (hosted: https://integrate.api.nvidia.com/v1; self-hosted: http://<host>:8000/v1).","For the hosted endpoint, also set NVIDIA_NIM_LLM_API_KEY; the base-path guard does not check it but later calls will 401 without it.","Restart AnythingLLM so process.env reloads.","Confirm with curl <base path>/models (add Authorization for the hosted endpoint)."],"exampleFix":"// before (.env)\n// NVIDIA_NIM_LLM_BASE_PATH=\n// NVIDIA_NIM_LLM_API_KEY=\n\n// after (.env) - hosted\nNVIDIA_NIM_LLM_BASE_PATH=https://integrate.api.nvidia.com/v1\nNVIDIA_NIM_LLM_API_KEY=nvapi-...your-key","handlingStrategy":"validation","validationCode":"const base = process.env.NVIDIA_NIM_LLM_BASE_PATH;\nif (!base) {\n  throw new Error(\n    'Cannot start NVIDIA NIM agent: set NVIDIA_NIM_LLM_BASE_PATH (hosted https://integrate.api.nvidia.com/v1 or self-hosted http://<host>:8000/v1) in .env.'\n  );\n}\ntry { new URL(base); } catch { throw new Error('NVIDIA_NIM_LLM_BASE_PATH is not a valid URL'); }\n// Guard checks only base path; warn if the hosted endpoint lacks a key:\nif (base.includes('integrate.api.nvidia.com') && !process.env.NVIDIA_NIM_LLM_API_KEY) {\n  console.warn('Hosted NIM endpoint selected but NVIDIA_NIM_LLM_API_KEY is unset - auth will fail later');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agentHandler.start();\n} catch (e) {\n  if (/NVIDIA NIM base path must be provided/.test(e.message)) {\n    return respondConfigError('nvidia-nim', ['NVIDIA_NIM_LLM_BASE_PATH', 'NVIDIA_NIM_LLM_API_KEY']);\n  }\n  throw e;\n}","preventionTips":["The guard checks only the base path; for the hosted endpoint also set NVIDIA_NIM_LLM_API_KEY to avoid a later 401.","For self-hosted NIM, confirm the container is up and reachable before configuring the provider.","Restart AnythingLLM after .env edits.","Add a boot reachability check for the configured base path."],"tags":["agents","llm-provider","nvidia-nim","nim","environment-variables","config"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}