{"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/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/novita/index.js#L206-L242","documentation":"NovitaLLM.getChatCompletion validates this.model by first syncing the Novita model catalog (#syncModels, cached on disk under storage/models/novita) and then checking whether the model id is a key of this.models(). If the configured id is not in the synced catalog, the check fails and this error is thrown before any completion request.","triggerScenarios":"NOVITA_LLM_MODEL_PREF or a workspace-selected model id that Novita no longer offers (renamed/deprecated); a stale or empty local model cache because the sync request failed (NovitaLLM sets a 3s default timeout, so slow networks can yield an empty catalog); model ids copied from outdated docs.","commonSituations":"Novita rotating its catalog while the on-disk cache is stale; picking model ids from old tutorials; flaky egress making the initial sync return nothing.","solutions":["Force a model re-sync: delete storage/models/novita (respecting STORAGE_DIR if set) or refresh the model list in the AnythingLLM UI, then retry","Verify the exact id via the Novita API model list and set NOVITA_LLM_MODEL_PREF to it","Confirm network egress to api.novita.ai works — the 3s sync timeout silently produces an empty catalog","Re-select the model from the UI dropdown after the list refreshes"],"exampleFix":"# before\nNOVITA_LLM_MODEL_PREF=meta-llama/old-id\n# after (id must appear in the synced Novita catalog)\nNOVITA_LLM_MODEL_PREF=meta-llama/llama-3.1-8b-instruct","handlingStrategy":"validation","validationCode":"const models = llm.models(); // populated by #syncModels()\nif (!Object.prototype.hasOwnProperty.call(models, llm.model))\n  throw new Error(`Model ${llm.model} not in synced Novita catalog — refresh model list`);","typeGuard":null,"tryCatchPattern":"try {\n  await llm.getChatCompletion(messages);\n} catch (e) {\n  if (/Novita chat: .* is not valid/.test(e.message)) {\n    // refresh storage/models/novita cache, confirm the id, then retry\n  }\n  throw e;\n}","preventionTips":["Refresh the model cache after Novita catalog changes (delete storage/models/novita)","Pick model ids from the UI dropdown backed by the synced list","Watch the 3s default sync timeout on slow networks — a failed sync yields an empty catalog","Validate the stored model id after provider reconfiguration"],"tags":["novita","anythingllm","model-validation","chat-completion","model-cache"],"backgroundTag":"invalid-model-id","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"}