{"record":{"id":"061ba23505da55b4","repo":"Mintplex-Labs/anything-llm","slug":"no-embedding-model-was-set","errorCode":null,"errorMessage":"No embedding model was set.","messagePattern":"No embedding model was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/EmbeddingEngines/lmstudio/index.js","lineNumber":12,"sourceCode":"const { parseLMStudioBasePath } = require(\"../../AiProviders/lmStudio\");\nconst {\n  maximumChunkLength,\n  reportEmbeddingProgress,\n} = require(\"../../helpers\");\n\nclass LMStudioEmbedder {\n  constructor() {\n    if (!process.env.EMBEDDING_BASE_PATH)\n      throw new Error(\"No embedding base path was set.\");\n    if (!process.env.EMBEDDING_MODEL_PREF)\n      throw new Error(\"No embedding model was set.\");\n\n    const apiKey = process.env.LMSTUDIO_AUTH_TOKEN ?? null;\n    this.className = \"LMStudioEmbedder\";\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.lmstudio = new OpenAIApi({\n      baseURL: parseLMStudioBasePath(process.env.EMBEDDING_BASE_PATH),\n      apiKey,\n    });\n    this.model = process.env.EMBEDDING_MODEL_PREF;\n\n    // Limit of how many strings we can process in a single pass to stay with resource or network limits\n    this.maxConcurrentChunks = 1;\n    this.embeddingMaxChunkLength = maximumChunkLength();\n  }\n\n  log(text, ...args) {\n    console.log(`\\x1b[36m[${this.className}]\\x1b[0m ${text}`, ...args);\n  }","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/EmbeddingEngines/lmstudio/index.js#L1-L30","documentation":"Thrown by the LMStudioEmbedder constructor when EMBEDDING_MODEL_PREF is unset. There is no default because LM Studio only serves the models you explicitly loaded; the embedder needs the exact id of a loaded embedding model. This check runs after the base-path check, so seeing it means EMBEDDING_BASE_PATH is already set.","triggerScenarios":"Configuring the LMStudio embedding engine with a URL but empty model field; deleting EMBEDDING_MODEL_PREF from .env; settings saved before a model was chosen.","commonSituations":"Assuming LM Studio embeds with 'whatever model is in the chat tab' — embeddings require a dedicated embedding model to be loaded (e.g. nomic-embed-text) and its id recorded here.","solutions":["Load an embedding model in LM Studio (not a chat model), e.g. nomic-embed-text-v1.5","Copy its exact model id from LM Studio's server/UI","Set EMBEDDING_MODEL_PREF to that id and restart"],"exampleFix":"# before\nEMBEDDING_BASE_PATH=http://localhost:1234/v1\n# EMBEDDING_MODEL_PREF unset\n\n# after\nEMBEDDING_BASE_PATH=http://localhost:1234/v1\nEMBEDDING_MODEL_PREF=text-embedding-nomic-embed-text-v1.5","handlingStrategy":"validation","validationCode":"function assertLMStudioModelSelected() {\n  if (!process.env.EMBEDDING_MODEL_PREF) {\n    throw new Error(\"LMStudio embedder needs EMBEDDING_MODEL_PREF set to a loaded embedding model id\");\n  }\n}\nassertLMStudioModelSelected();","typeGuard":null,"tryCatchPattern":"try {\n  const embedder = new LMStudioEmbedder();\n} catch (e) {\n  if (e.message === \"No embedding model was set.\") {\n    // load an embedding model in LM Studio, then set its exact id here\n  }\n  throw e;\n}","preventionTips":["Load a dedicated embedding model (e.g. nomic-embed-text-v1.5) and copy its exact id — chat models will fail later in embedChunks","Populate the model dropdown from the live /models endpoint in the settings UI","Block saving the embedding config with an empty model field"],"tags":["lmstudio","local-server","model-name","env-var","constructor"],"backgroundTag":"missing-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}