Billionmail/BillionMail · error

verification type must be either 'http' or 'dns'

Error message

verification type must be either 'http' or 'dns'

What it means

AcmeCLI.Validate returns this error when VerifyType is neither "http" nor "dns". The CLI only supports those two ACME challenge types; anything else (including empty or differently-cased values) is rejected before calling Apply.

Source

Thrown at core/internal/service/acme/cli.go:96

/**
 * @brief Validate parameters
 * @return error
 */
func (cli *AcmeCLI) Validate() error {
	// Check email
	if cli.Email == "" {
		return fmt.Errorf("email is required")
	}

	// Check domains
	if len(cli.Domains) == 0 {
		return fmt.Errorf("at least one domain is required")
	}

	// Check verification type
	if cli.VerifyType != "http" && cli.VerifyType != "dns" {
		return fmt.Errorf("verification type must be either 'http' or 'dns'")
	}

	// Check DNS provider if using DNS verification
	if cli.VerifyType == "dns" {
		if cli.DnsProvider == "" {
			return fmt.Errorf("DNS provider is required for DNS verification")
		}

		// Check if DNS provider is supported
		supportedProviders := []string{"tencentcloud", "alidns", "cloudxns", "azuredns", "cloudflare", "godaddy"}
		isSupported := false
		for _, provider := range supportedProviders {
			if cli.DnsProvider == provider {
				isSupported = true
				break
			}
		}

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Set VerifyType to exactly "http" or "dns" (lowercase)
  2. Normalize user input with strings.ToLower(strings.TrimSpace(v)) before assignment
  3. Default to "http" when the flag is omitted

Example fix

// before
cli.VerifyType = "DNS" // case mismatch
// after
cli.VerifyType = strings.ToLower(strings.TrimSpace(flagVerify))
if cli.VerifyType == "" { cli.VerifyType = "http" }
Defensive patterns

Strategy: validation

Validate before calling

allowed := map[string]bool{"http": true, "dns": true}
v := strings.ToLower(strings.TrimSpace(flagVerify))
if !allowed[v] { return fmt.Errorf("verify type must be http or dns, got %q", flagVerify) }

Try / catch

if err := cli.Validate(); err != nil {
    if strings.Contains(err.Error(), "verification type must be") {
        log.Printf("invalid --verify-type %q: use http or dns", cli.VerifyType)
    }
    os.Exit(1)
}

Prevention

When it happens

Trigger: Setting cli.VerifyType to "HTTP", "tls-alpn-01", "", or any value other than exactly "http"/"dns", then calling Validate/Apply.

Common situations: Case mismatch ("HTTP") when copying from docs; users expecting tls-alpn-01 support; empty VerifyType when the flag is omitted and there is no default.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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