{"record":{"id":"3f8380d7aab958d6","repo":"Mintplex-Labs/anything-llm","slug":"novita-chat-this-model-is-not-valid-for-chat-c","errorCode":null,"errorMessage":"Novita chat: ${this.model} is not valid for chat completion!","messagePattern":"Novita chat: (.+?) is not valid for chat completion!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/novita/index.js","lineNumber":224,"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 (!(await this.isValidChatCompletionModel(this.model)))\n      throw new Error(\n        `Novita chat: ${this.model} is not valid for chat completion!`\n      );\n\n    const result = await LLMPerformanceMonitor.measureAsyncFunction(\n      this.openai.chat.completions\n        .create({\n          model: this.model,\n          messages,\n          temperature,\n        })\n        .catch((e) => {\n          throw new Error(e.message);\n        })\n    );\n\n    if (\n      !result.output.hasOwnProperty(\"choices\") ||\n      result.output.choices.length === 0","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/novita/index.js#L206-L242","documentation":"getChatCompletion validates this.model via isValidChatCompletionModel before the Novita call; throws 'Novita chat: <model> is not valid...' when the model id is not in the resolved Novita model set.","triggerScenarios":"Calling getChatCompletion with a model id not present in Novita's model catalog — typo, a model id from another provider, or a deindexed Novita model.","commonSituations":"Wrong/typo model id in the provider config; copied a model id from OpenAI/another provider into Novita; Novita removed the model; stale cached model list under storage/models/novita.","solutions":["Confirm the model id exists on Novita's platform (api.novita.ai).","Refresh the cached model list in storage/models/novita.","Correct the configured model to a valid Novita model id.","Ensure network access for the model-list fetch."],"exampleFix":"// before\n// model = 'gpt-4' (not a Novita model) -> throws\n\n// after\n// model = 'meta-llama/llama-3-70b' (valid Novita id)","handlingStrategy":"validation","validationCode":"const valid = await llm.isValidChatCompletionModel(llm.model);\nif (!valid) {\n  throw new Error(`Model '${llm.model}' not in Novita catalog — check the configured model id.`);\n}","typeGuard":"function isKnownNovitaModel(model, catalog) {\n  return typeof model === 'string' && model.length > 0 && catalog.includes(model);\n}","tryCatchPattern":"try {\n  await llm.getChatCompletion(messages, { temperature });\n} catch (e) {\n  if (/Novita chat:.*not valid for chat completion/i.test(e.message)) {\n    // reconfigure model id\n  }\n}","preventionTips":["Do not copy model ids from other providers into Novita config.","Validate model ids against the Novita catalog in the admin UI.","Refresh the cached catalog under storage/models/novita."],"tags":["novita","model-validation","chat-completion","configuration"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}