Billionmail/BillionMail · error

Model not found

Error message

Model not found

What it means

Chat resolves the model via GetModelInfo(supplierName, modelId) and returns this error when it returns nil, meaning the model ID is unknown for that supplier. The client cannot be initialized without model metadata such as MaxTokens.

Source

Thrown at core/internal/service/askai/chat.go:256

	}
	chatInfo.Messages = GetMessages(chatId)
	return chatInfo, nil
}

func Chat(ctx context.Context, chatId string, supplierName string, modelId string, content string, isText bool) error {
	content = strings.TrimSpace(content)
	if content == "" {
		return errors.New("Content cannot be empty")
	}

	supplierInfo, err := GetSupplierConfig(supplierName)
	if err != nil {
		return errors.New("Supplier not found")
	}

	modelInfo := GetModelInfo(supplierName, modelId)
	if modelInfo == nil {
		return errors.New("Model not found")
	}

	// Check if the chat is already active
	chatInfo, err := GetChat(chatId)
	if err != nil {
		return errors.New("Chat not found")
	}
	// set the chat information
	chatInfo.SupplierName = supplierName
	chatInfo.ModelId = modelId
	err = SaveChat(chatId, chatInfo)
	if err != nil {
		return errors.New("Failed to save chat")
	}

	ChatStatus[chatId] = true // Set chat status to active
	defer func() {
		delete(ChatStatus, chatId) // Ensure chat status is removed after processing

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Call GetModelInfo(supplierName, modelId) yourself first and confirm it is non-nil
  2. Refresh the supplier's model list and pick a valid modelId
  3. Update stored chat configurations that reference removed models

Example fix

// before
err := askai.Chat(ctx, chatId, supplier, "gpt-3.5-turbo-0301", content, true)
// after
if askai.GetModelInfo(supplier, "gpt-4o-mini") == nil {
    return errors.New("model unavailable for supplier")
}
err := askai.Chat(ctx, chatId, supplier, "gpt-4o-mini", content, true)
Defensive patterns

Strategy: validation

Validate before calling

if askai.GetModelInfo(supplierName, modelId) == nil {
    return fmt.Errorf("model %q unavailable for supplier %q", modelId, supplierName)
}

Prevention

When it happens

Trigger: Calling Chat with a modelId that does not exist under the given supplier (wrong ID, model removed from the supplier's catalog, model listed under a different supplier).

Common situations: Supplier deprecated/renamed a model (e.g., GPT model version retirement); hardcoded modelId after switching suppliers; stale chat records pointing at a deleted model entry.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/40b74c9e81fa4bfe. Report an issue: GitHub.