Billionmail/BillionMail · error

model not found

Error message

model not found

What it means

SetModelStatus scans the supplier's models.json for a matching ModelId and returns this error when no entry matches. The models file exists and is readable; the requested modelId simply is not in the list.

Source

Thrown at core/internal/service/askai/supplier.go:591

// SetModelStatus updates the status of a specific model in the supplier's models.json file.
// It reads the existing models, modifies the status of the specified model, and saves the updated list back to the file.
// If the model is not found, it returns an error indicating that the model does not exist
func SetModelStatus(supplierName string, modelId string, status bool) error {
	modelsFile := SUPPLIER_CONFIG_PATH + "/" + supplierName + "/models.json"

	// Read existing models
	existingModels := GetModelList(supplierName)

	// Update the model status
	for i, model := range existingModels {
		if model.ModelId == modelId {
			existingModels[i].Status = status
			return saveModelsToFile(modelsFile, existingModels)
		}
	}

	return errors.New("model not found")
}

// AddSupplier creates a new supplier configuration file with the provided details.
// It checks if a supplier with the same name already exists, and if not, it creates a new Supplier struct
func AddSupplier(supplierTitle string, supplierName string, baseUrl string, apiKey string) error {
	supplierPath := SUPPLIER_CONFIG_PATH + "/" + supplierName
	if public.FileExists(supplierPath) {
		return errors.New("supplier already exists")
	}

	supplier := Supplier{
		SupplierTitle:   supplierTitle,
		SupplierName:    supplierName,
		BaseUrl:         baseUrl,
		BaseUrlExample:  baseUrl,
		IsUseUrlExample: false,
		ApiKey:          apiKey,
		Home:            "",

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Call GetModelList(supplierName) and confirm the exact ModelId before calling SetModelStatus
  2. Check for typos or trailing whitespace in the modelId argument
  3. Verify you are targeting the correct supplierName

Example fix

// before: guessing a model id
err := SetModelStatus("openai", "gpt4-turbo", false)

// after: resolve the real id first
models := GetModelList("openai")
for _, m := range models {
    if strings.Contains(m.ModelId, "gpt-4") {
        err := SetModelStatus("openai", m.ModelId, false)
    }
}
Defensive patterns

Strategy: validation

Validate before calling

func modelExists(supplierName, modelId string) bool {
    for _, m := range GetModelList(supplierName) {
        if m.ModelId == modelId { return true }
    }
    return false
}
// guard: if !modelExists(supplier, id) { skip }

Type guard

func findModel(supplierName, modelId string) *Model {
    for i, m := range GetModelList(supplierName) {
        if m.ModelId == modelId { return &GetModelList(supplierName)[i] }
    }
    return nil
}

Try / catch

if err := SetModelStatus(supplier, modelId, status); err != nil {
    if strings.Contains(err.Error(), "model not found") {
        // refresh model list or skip unknown id
    } else { return err }
}

Prevention

When it happens

Trigger: SetModelStatus(supplierName, modelId, status) with a modelId that is misspelled, was removed, or belongs to a different supplier than the one passed.

Common situations: Renamed/deprecated model IDs (e.g. vendor renamed a model); hard-coded modelId strings that drifted; passing a model that exists on another supplier.

Related errors


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