Mintplex-Labs/anything-llm · error · Error
Novita chat: is not valid for chat completion!
Error message
Novita chat: ${this.model} is not valid for chat completion! What it means
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.
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
Example fix
# before NOVITA_LLM_MODEL_PREF=meta-llama/old-id # after (id must appear in the synced Novita catalog) NOVITA_LLM_MODEL_PREF=meta-llama/llama-3.1-8b-instruct
Defensive patterns
Strategy: validation
Validate before calling
const models = llm.models(); // populated by #syncModels()
if (!Object.prototype.hasOwnProperty.call(models, llm.model))
throw new Error(`Model ${llm.model} not in synced Novita catalog — refresh model list`); Try / catch
try {
await llm.getChatCompletion(messages);
} catch (e) {
if (/Novita chat: .* is not valid/.test(e.message)) {
// refresh storage/models/novita cache, confirm the id, then retry
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- LocalAI chat: is not valid for chat completion!
- Minimax chat: is not valid for chat completion!
- Minimax stream: is not valid for chat completion!
- Mistral chat: is not valid for chat completion!
- GroqAI:chatCompletion
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/3f8380d7aab958d6.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/AiProviders/novita/index.js:224
attachments = [],
}) {
const prompt = {
role: "system",
content: `${systemPrompt}${this.#appendContext(contextTexts)}`,
};
return [
prompt,
...formatChatHistory(chatHistory, this.#generateContent),
{
role: "user",
content: this.#generateContent({ userPrompt, attachments }),
},
];
}
async getChatCompletion(messages = null, { temperature = 0.7 }) {
if (!(await this.isValidChatCompletionModel(this.model)))
throw new Error(
`Novita chat: ${this.model} is not valid for chat completion!`
);
const result = await LLMPerformanceMonitor.measureAsyncFunction(
this.openai.chat.completions
.create({
model: this.model,
messages,
temperature,
})
.catch((e) => {
throw new Error(e.message);
})
);
if (
!result.output.hasOwnProperty("choices") ||
result.output.choices.length === 0View on GitHub (pinned to 3aec848f28)