Mintplex-Labs/anything-llm · error · Error
Novita chat: ${this.model} is not valid for chat completion!
Error message
Novita chat: ${this.model} is not valid for chat completion! What it means
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.
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 526360e320)
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.
Example fix
// before // model = 'gpt-4' (not a Novita model) -> throws // after // model = 'meta-llama/llama-3-70b' (valid Novita id)
Defensive patterns
Strategy: validation
Validate before calling
const valid = await llm.isValidChatCompletionModel(llm.model);
if (!valid) {
throw new Error(`Model '${llm.model}' not in Novita catalog — check the configured model id.`);
} Type guard
function isKnownNovitaModel(model, catalog) {
return typeof model === 'string' && model.length > 0 && catalog.includes(model);
} Try / catch
try {
await llm.getChatCompletion(messages, { temperature });
} catch (e) {
if (/Novita chat:.*not valid for chat completion/i.test(e.message)) {
// reconfigure model id
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Minimax chat: ${this.model} is not valid for chat completion
- Mistral chat: ${this.model} is not valid for chat completion
- DeepSeek chat: ${this.model} is not valid for chat completio
- Foundry chat: ${this.model} is not valid or defined model fo
- GroqAI:chatCompletion: ${this.model} is not valid for chat c
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/3f8380d7aab958d6.
Report an issue: GitHub.