Billionmail/BillionMail · warning
supplier name, base URL, and API key are required
Error message
supplier name, base URL, and API key are required
What it means
Testing performs a connectivity/credential check of an AI supplier (URL reachability plus API key validation). Before doing any network work it requires all three inputs — supplierName, baseUrl, apiKey — to be non-empty; otherwise it returns this validation error immediately.
Source
Thrown at core/internal/service/askai/supplier.go:484
if err != nil {
return errors.New("supplier configuration not found")
}
supplierConfig.BaseUrl = baseUrl
supplierConfig.ApiKey = apiKey
return SaveSupplierConfig(supplierName, *supplierConfig)
}
// Testing validates the supplier's configuration by checking the base URL and API key.
// It performs the following checks:
// 1. Validates the base URL format.
// 2. Tests the accessibility of the base URL by sending a HEAD request.
// 3. Validates the API key by sending a GET request to the models endpoint.
// If any of these checks fail, it returns an error indicating the issue.
func Testing(supplierName, baseUrl, apiKey string) error {
if supplierName == "" || baseUrl == "" || apiKey == "" {
return errors.New("supplier name, base URL, and API key are required")
}
// Validate base URL format
parsedUrl, err := url.ParseRequestURI(baseUrl)
if err != nil {
return fmt.Errorf("invalid base URL format: %w", err)
}
if parsedUrl.Scheme != "http" && parsedUrl.Scheme != "https" {
return errors.New("base URL must use http or https protocol")
}
// Ensure the base URL ends with a slash
if err := testBaseURLAccessibility(baseUrl); err != nil {
return fmt.Errorf("base URL accessibility test failed: %w", err)
}
// Validate API key by making a request to the models endpoint
if err := testAPIKeyValidity(baseUrl, apiKey); err != nil {
return fmt.Errorf("API key validation failed: %w", err)
}View on GitHub (pinned to fc36c76c05)
Solutions
- Ensure supplierName, baseUrl, and apiKey are all non-empty before calling Testing
- Load the API key from the proper source (config, env, secret store) and confirm it is populated
- Add client-side required-field validation on the form that feeds Testing
Example fix
// before
err := askai.Testing(name, baseUrl, apiKey) // apiKey was ""
// after
if name == "" || baseUrl == "" || apiKey == "" {
return fmt.Errorf("fill in supplier name, base URL, and API key before testing")
}
err := askai.Testing(name, baseUrl, apiKey) Defensive patterns
Strategy: validation
Validate before calling
func inputsReady(name, baseUrl, apiKey string) bool {
return strings.TrimSpace(name) != "" && strings.TrimSpace(baseUrl) != "" && strings.TrimSpace(apiKey) != ""
}
if !inputsReady(supplierName, baseUrl, apiKey) {
return errors.New("all fields are required before testing")
} Try / catch
if err := askai.Testing(name, baseUrl, apiKey); err != nil {
if err.Error() == "supplier name, base URL, and API key are required" {
return fmt.Errorf("please fill in all supplier fields")
}
return err
} Prevention
- Add required-field validation in the UI before invoking Testing
- Trim inputs; empty-after-trim is as bad as empty
- Load API keys from env/secret store and fail fast if unset
- Never call Testing with zero-value struct fields — check them first
When it happens
Trigger: Calling askai.Testing with any of: empty supplier name, empty base URL, or empty API key.
Common situations: Form fields not yet filled in by the user when a 'test connection' button is clicked; API key not loaded from environment/storage (empty env var); supplier name lost during state passing.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- invalid base URL format: %w
- Prefixes can contain only letters, numbers, underscores, and
- Add up to 3 URLs
- supplier configuration not found
- base URL must use http or https protocol
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/92d09234666901e7.
Report an issue: GitHub.