{"record":{"id":"1ca94495a16b4a0d","repo":"Mintplex-Labs/anything-llm","slug":"lmstudio-base-path-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"LMStudio base path must be provided to use agents.","messagePattern":"LMStudio base path must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/agents/index.js","lineNumber":140,"sourceCode":"    } catch (e) {\n      this.log(\"Error loading chat history\", e.message);\n      return [];\n    }\n  }\n\n  checkSetup() {\n    switch (this.provider) {\n      case \"openai\":\n        if (!process.env.OPEN_AI_KEY)\n          throw new Error(\"OpenAI API key must be provided to use agents.\");\n        break;\n      case \"anthropic\":\n        if (!process.env.ANTHROPIC_API_KEY)\n          throw new Error(\"Anthropic API key must be provided to use agents.\");\n        break;\n      case \"lmstudio\":\n        if (!process.env.LMSTUDIO_BASE_PATH)\n          throw new Error(\"LMStudio base path must be provided to use agents.\");\n        break;\n      case \"ollama\":\n        if (!process.env.OLLAMA_BASE_PATH)\n          throw new Error(\"Ollama base path must be provided to use agents.\");\n        break;\n      case \"groq\":\n        if (!process.env.GROQ_API_KEY)\n          throw new Error(\"Groq API key must be provided to use agents.\");\n        break;\n      case \"togetherai\":\n        if (!process.env.TOGETHER_AI_API_KEY)\n          throw new Error(\"TogetherAI API key must be provided to use agents.\");\n        break;\n      case \"azure\":\n        if (!process.env.AZURE_OPENAI_ENDPOINT || !process.env.AZURE_OPENAI_KEY)\n          throw new Error(\n            \"Azure OpenAI API endpoint and key must be provided to use agents.\"\n          );","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L122-L158","documentation":"checkSetup() (index.js:138-141) throws for provider === \"lmstudio\" when process.env.LMSTUDIO_BASE_PATH is falsy. Unlike cloud providers, LM Studio needs a base URL (its local OpenAI-compatible server), not an API key, so that is what is validated before the agent runs.","triggerScenarios":"Selecting the lmstudio agent provider while LMSTUDIO_BASE_PATH is unset, e.g. before starting/pointing at the LM Studio server.","commonSituations":"Local-only provider selected without configuring the server URL, the LM Studio server not running yet, or a typo in the base path.","solutions":["Set LMSTUDIO_BASE_PATH (e.g. http://127.0.0.1:1234/v1) in .env.","Start the LM Studio local server and load a model.","Restart the server process after editing .env.","Verify the URL is reachable from the AnythingLLM process (no firewall/loopback mismatch)."],"exampleFix":"# before (.env)\n# LMSTUDIO_BASE_PATH=\n\n# after (.env)\nLMSTUDIO_BASE_PATH=http://127.0.0.1:1234/v1","handlingStrategy":"validation","validationCode":"function lmStudioAgentReady() {\n  return Boolean(process.env.LMSTUDIO_BASE_PATH && process.env.LMSTUDIO_BASE_PATH.trim());\n}\nif (provider === \"lmstudio\" && !lmStudioAgentReady())\n  throw new Error(\"Set LMSTUDIO_BASE_PATH (e.g. http://127.0.0.1:1234/v1) before enabling the lmstudio agent.\");","typeGuard":null,"tryCatchPattern":"try {\n  agent.checkSetup();\n} catch (e) {\n  if (/LMSTUDIO_BASE_PATH|base path must be provided/i.test(e.message)) {\n    throw new Error(\"LMStudio agent is not configured: set LMSTUDIO_BASE_PATH in .env and restart.\");\n  }\n  throw e;\n}","preventionTips":["Run checkSetup() at startup so the URL is validated early.","Ensure the LM Studio local server is running before enabling the provider.","Restart the server process after editing .env.","Verify loopback/host reachability (especially inside Docker)."],"tags":["lmstudio","config","env","agents","local-llm"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}