Mintplex-Labs/anything-llm · error · Error

Minimax stream: ${this.model} is not valid for chat completi

Error message

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

What it means

Identical model-validation guard to the non-streaming path, but in streamGetChatCompletion. Before opening the stream it awaits isValidChatCompletionModel(this.model); on failure it throws with the 'Minimax stream:' prefix so callers can tell which entry point rejected the model.

Source

Thrown at server/utils/AiProviders/minimax/index.js:125

    return {
      textResponse: result.output.choices[0].message.content,
      metrics: {
        prompt_tokens: result.output.usage.prompt_tokens || 0,
        completion_tokens: result.output.usage.completion_tokens || 0,
        total_tokens: result.output.usage.total_tokens || 0,
        outputTps: result.output.usage.completion_tokens / result.duration,
        duration: result.duration,
        model: this.model,
        provider: this.className,
        timestamp: new Date(),
      },
    };
  }

  async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {
    if (!(await this.isValidChatCompletionModel(this.model)))
      throw new Error(
        `Minimax stream: ${this.model} is not valid for chat completion!`
      );

    const measuredStreamRequest = await LLMPerformanceMonitor.measureStream({
      func: this.openai.chat.completions.create({
        model: this.model,
        stream: true,
        messages,
        temperature,
      }),
      messages,
      runPromptTokenCalculation: false,
      modelTag: this.model,
      provider: this.className,
    });

    return measuredStreamRequest;
  }

View on GitHub (pinned to 526360e320)

Solutions

  1. Verify this.model against the current Minimax model list.
  2. Refresh the cached catalog in storage/models/minimax.
  3. Correct MINIMAX_MODEL_PREF and restart.
  4. Ensure network access for the model-list fetch used by isValidChatCompletionModel.
Defensive patterns

Strategy: validation

Validate before calling

const valid = await llm.isValidChatCompletionModel(llm.model);
if (!valid) {
  throw new Error(`Model '${llm.model}' not valid for Minimax streaming — check MINIMAX_MODEL_PREF.`);
}

Type guard

function isKnownMinimaxModel(model, catalog) {
  return typeof model === 'string' && catalog.includes(model);
}

Try / catch

try {
  await llm.streamGetChatCompletion(messages, { temperature });
} catch (e) {
  if (/Minimax stream:.*not valid for chat completion/i.test(e.message)) {
    // fix model config, do not retry
  }
}

Prevention

When it happens

Trigger: Calling streamGetChatCompletion with a this.model value not in the Minimax chat model catalog — same root causes as the getChatCompletion variant (typo, retired model, stale cache).

Common situations: Streaming chat enabled with a stale or mistyped MINIMAX_MODEL_PREF; switching models after the cached catalog became outdated; embedding model id used for streaming chat.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/7416851df558546d. Report an issue: GitHub.