Billionmail/BillionMail · error

supplier configuration is incomplete, cannot set status

Error message

supplier configuration is incomplete, cannot set status

What it means

SetSupplierStatus reads a supplier's config and refuses to toggle status when essential fields are blank. If ApiKey or BaseUrl is empty, the supplier is considered non-functional, so enabling/disabling it is rejected. This prevents activating a half-configured supplier that would fail at request time.

Source

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

	}
}

// GetSupplierConfig retrieves the configuration for a specific supplier by its name.
// It reads the configuration file and returns a Supplier struct containing the supplier's details.
// If the configuration file does not exist or an error occurs, it returns an error.
func GetSupplierConfig(supplierName string) (*Supplier, error) {
	return ReadSupplierConfig(supplierName)
}

// SetSupplierStatus updates the status of a supplier in its configuration file.
// It reads the existing configuration, modifies the status, and saves it back to the file.
func SetSupplierStatus(supplierName string, status bool) error {
	supplierConfig, err := ReadSupplierConfig(supplierName)
	if err != nil {
		return errors.New("supplier configuration not found")
	}
	if supplierConfig.ApiKey == "" || supplierConfig.BaseUrl == "" {
		return errors.New("supplier configuration is incomplete, cannot set status")
	}
	supplierConfig.Status = status

	return SaveSupplierConfig(supplierName, *supplierConfig)
}

// 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 {

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Read the supplier config and populate ApiKey and BaseUrl (re-run AddSupplier or edit the config JSON), then call SetSupplierStatus again
  2. Verify SUPPLIER_CONFIG_PATH/<name> contains valid JSON with non-empty api_key and base_url fields
  3. If the supplier is unwanted, remove it with RemoveSupplier and recreate it with complete credentials

Example fix

// before: toggling a supplier with empty key
SetSupplierStatus("openai", true) // -> "supplier configuration is incomplete"

// after: repair config first
cfg, _ := ReadSupplierConfig("openai")
cfg.ApiKey = os.Getenv("OPENAI_API_KEY")
cfg.BaseUrl = "https://api.openai.com/v1"
SaveSupplierConfig("openai", *cfg)
SetSupplierStatus("openai", true)
Defensive patterns

Strategy: validation

Validate before calling

func canSetStatus(supplierName string) error {
    cfg, err := ReadSupplierConfig(supplierName)
    if err != nil { return err }
    if cfg.ApiKey == "" || cfg.BaseUrl == "" {
        return errors.New("complete api_key and base_url before toggling status")
    }
    return nil
}
// call canSetStatus(name) before SetSupplierStatus

Type guard

func supplierConfigComplete(cfg *Supplier) bool {
    return cfg != nil && cfg.ApiKey != "" && cfg.BaseUrl != ""
}

Try / catch

if err := SetSupplierStatus(name, true); err != nil {
    if strings.Contains(err.Error(), "configuration is incomplete") {
        // repair config then retry
    } else { return err }
}

Prevention

When it happens

Trigger: Calling SetSupplierStatus(name, true/false) for a supplier whose config file exists but has an empty ApiKey or BaseUrl, e.g. after AddSupplier was interrupted or the config JSON was hand-edited.

Common situations: Manually created or partially saved supplier config files; a supplier created without an API key (free-tier/no-key supplier); config file corrupted or fields removed during migration.

Related errors


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