{"record":{"id":"78674e91102bb7f0","repo":"Mintplex-Labs/anything-llm","slug":"privatemode-chat-this-model-is-not-valid-or-de","errorCode":null,"errorMessage":"Privatemode chat: ${this.model} is not valid or defined model for chat completion!","messagePattern":"Privatemode chat: (.+?) is not valid or defined model for chat completion!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/privatemode/index.js","lineNumber":145,"sourceCode":"    attachments = [],\n  }) {\n    const prompt = {\n      role: \"system\",\n      content: `${systemPrompt}${this.#appendContext(contextTexts)}`,\n    };\n    return [\n      prompt,\n      ...formatChatHistory(chatHistory, this.#generateContent),\n      {\n        role: \"user\",\n        content: this.#generateContent({ userPrompt, attachments }),\n      },\n    ];\n  }\n\n  async getChatCompletion(messages = null, { temperature = 0.7 }) {\n    if (!this.model)\n      throw new Error(\n        `Privatemode chat: ${this.model} is not valid or defined model for chat completion!`\n      );\n\n    const result = await LLMPerformanceMonitor.measureAsyncFunction(\n      this.client.chat.completions.create({\n        model: this.model,\n        messages,\n        temperature,\n      })\n    );\n\n    if (\n      !result.output.hasOwnProperty(\"choices\") ||\n      result.output.choices.length === 0\n    )\n      return null;\n\n    return {","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/privatemode/index.js#L127-L163","documentation":"Sentinel guard in PrivatemodeLLM.getChatCompletion: this.model is falsy, meaning the Privatemode model preference never resolved to an identifier, so a non-streaming completion cannot name a target model and is rejected.","triggerScenarios":"Thrown when the configured Privatemode model is invalid.","commonSituations":"Model preference set to an unavailable model.","solutions":["Set a valid Privatemode model for chat completion."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}