Billionmail/BillionMail · error

DNS provider is required for DNS verification

Error message

DNS provider is required for DNS verification

What it means

Parameter check in AcmeCLI.Validate: VerifyType was set to "dns" but DnsProvider is empty. DNS-01 verification needs a DNS API provider to create the challenge TXT record, so validation fails before the acme.sh DNS hook is selected.

Solutions

  1. Set cli.DnsProvider to one of the supported providers (e.g. cloudflare, alidns, tencentcloud)
  2. Pass --dns-provider <name> alongside --verify-type dns
  3. Skip requiring a provider when VerifyType is http

Example fix

// before
cli := &AcmeCLI{Email: e, Domains: d, VerifyType: "dns"} // provider missing
// after
cli := &AcmeCLI{Email: e, Domains: d, VerifyType: "dns", DnsProvider: "cloudflare", DnsConfig: cfg}
Defensive patterns

Strategy: validation

Validate before calling

if strings.EqualFold(cli.VerifyType, "dns") && strings.TrimSpace(cli.DnsProvider) == "" {
    return errors.New("--dns-provider must be set when verify-type is dns")
}

Try / catch

if err := cli.Validate(); err != nil {
    if strings.Contains(err.Error(), "DNS provider is required") {
        log.Printf("--dns-provider missing for dns verification of %v", cli.Domains)
    }
    os.Exit(1)
}

Prevention

When it happens

Trigger: Calling Validate/Apply with VerifyType="dns" but DnsProvider left unset (missing --dns-provider flag or empty config key).

Common situations: Switching from http to dns verification without updating the invocation; template-based automation where the provider field is only filled for some environments.

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


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

Appendix: source

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

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

		if !isSupported {
			return fmt.Errorf("unsupported DNS provider: %s, supported providers: %s",
				cli.DnsProvider, strings.Join(supportedProviders, ", "))
		}

		// Check DNS config

View on GitHub (pinned to fc36c76c05)