Mintplex-Labs/anything-llm · error · Error

PPIO chat: is not valid for chat completion!

Error message

PPIO chat: ${this.model} is not valid for chat completion!

What it means

Model validation in PPIOLLM.getChatCompletion: the configured this.model is not in PPIO's list of chat-capable models, so a chat completion request would fail upstream; it is rejected before the API call.

Solutions

  1. Select a PPIO model valid for chat completion.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when the configured PPIO model is not a chat model.

Common situations: Model preference set to an invalid model.


AI-assisted analysis of Mintplex-Labs/anything-llm@f92433b4ea (2026-08-18). Data as JSON: /api/errors/24e3b620652e2599. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/AiProviders/ppio/index.js:159

  }

  constructPrompt({
    systemPrompt = "",
    contextTexts = [],
    chatHistory = [],
    userPrompt = "",
    // attachments = [], - not supported
  }) {
    const prompt = {
      role: "system",
      content: `${systemPrompt}${this.#appendContext(contextTexts)}`,
    };
    return [prompt, ...chatHistory, { role: "user", content: userPrompt }];
  }

  async getChatCompletion(messages = null, { temperature = 0.7 }) {
    if (!(await this.isValidChatCompletionModel(this.model)))
      throw new Error(
        `PPIO 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 (
      !Object.prototype.hasOwnProperty.call(result.output, "choices") ||
      result.output.choices.length === 0

View on GitHub (pinned to f92433b4ea)