{"record":{"id":"7416851df558546d","repo":"Mintplex-Labs/anything-llm","slug":"minimax-stream-this-model-is-not-valid-for-cha","errorCode":null,"errorMessage":"Minimax stream: ${this.model} is not valid for chat completion!","messagePattern":"Minimax stream: (.+?) is not valid for chat completion!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/minimax/index.js","lineNumber":125,"sourceCode":"\n    return {\n      textResponse: result.output.choices[0].message.content,\n      metrics: {\n        prompt_tokens: result.output.usage.prompt_tokens || 0,\n        completion_tokens: result.output.usage.completion_tokens || 0,\n        total_tokens: result.output.usage.total_tokens || 0,\n        outputTps: result.output.usage.completion_tokens / result.duration,\n        duration: result.duration,\n        model: this.model,\n        provider: this.className,\n        timestamp: new Date(),\n      },\n    };\n  }\n\n  async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {\n    if (!(await this.isValidChatCompletionModel(this.model)))\n      throw new Error(\n        `Minimax stream: ${this.model} is not valid for chat completion!`\n      );\n\n    const measuredStreamRequest = await LLMPerformanceMonitor.measureStream({\n      func: this.openai.chat.completions.create({\n        model: this.model,\n        stream: true,\n        messages,\n        temperature,\n      }),\n      messages,\n      runPromptTokenCalculation: false,\n      modelTag: this.model,\n      provider: this.className,\n    });\n\n    return measuredStreamRequest;\n  }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/minimax/index.js#L107-L143","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify this.model against the current Minimax model list.","Refresh the cached catalog in storage/models/minimax.","Correct MINIMAX_MODEL_PREF and restart.","Ensure network access for the model-list fetch used by isValidChatCompletionModel."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const valid = await llm.isValidChatCompletionModel(llm.model);\nif (!valid) {\n  throw new Error(`Model '${llm.model}' not valid for Minimax streaming — check MINIMAX_MODEL_PREF.`);\n}","typeGuard":"function isKnownMinimaxModel(model, catalog) {\n  return typeof model === 'string' && catalog.includes(model);\n}","tryCatchPattern":"try {\n  await llm.streamGetChatCompletion(messages, { temperature });\n} catch (e) {\n  if (/Minimax stream:.*not valid for chat completion/i.test(e.message)) {\n    // fix model config, do not retry\n  }\n}","preventionTips":["Share one validated model id between streaming and non-streaming paths.","Validate the model once at construction, not separately in each method.","Keep the model catalog fresh."],"tags":["minimax","model-validation","streaming","configuration"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}