{"record":{"id":"65fafa51007345b5","repo":"Billionmail/BillionMail","slug":"email-is-required","errorCode":null,"errorMessage":"email is required","messagePattern":"email is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/acme/cli.go","lineNumber":86,"sourceCode":"/**\n * @brief Set HTTP verification\n * @return *AcmeCLI\n */\nfunc (cli *AcmeCLI) SetHTTPVerification() *AcmeCLI {\n\tcli.VerifyType = \"http\"\n\tcli.DnsProvider = \"\"\n\tcli.DnsConfig = nil\n\treturn cli\n}\n\n/**\n * @brief Validate parameters\n * @return error\n */\nfunc (cli *AcmeCLI) Validate() error {\n\t// Check email\n\tif cli.Email == \"\" {\n\t\treturn fmt.Errorf(\"email is required\")\n\t}\n\n\t// Check domains\n\tif len(cli.Domains) == 0 {\n\t\treturn fmt.Errorf(\"at least one domain is required\")\n\t}\n\n\t// Check verification type\n\tif cli.VerifyType != \"http\" && cli.VerifyType != \"dns\" {\n\t\treturn fmt.Errorf(\"verification type must be either 'http' or 'dns'\")\n\t}\n\n\t// Check DNS provider if using DNS verification\n\tif cli.VerifyType == \"dns\" {\n\t\tif cli.DnsProvider == \"\" {\n\t\t\treturn fmt.Errorf(\"DNS provider is required for DNS verification\")\n\t\t}\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/acme/cli.go#L68-L104","documentation":"Parameter check in AcmeCLI.Validate: the AcmeCLI builder was used without calling an email setter (or with an empty string), and ACME certificate authorities require a contact email for certificate issuance, so the validation aborts before any acme.sh command runs.","triggerScenarios":"Constructing AcmeCLI (directly or via applyCommand flag parsing) and calling Validate/Apply without setting Email, or passing an empty --email flag.","commonSituations":"Automated scripts omitting the email flag; config-driven invocation where the email key is missing or blank; copying example code that leaves Email unset.","solutions":["Set cli.Email to a valid address before calling Apply","Pass a non-empty --email flag on the apply command","Load the email from config/env and fail fast with a clear message if blank"],"exampleFix":"// before\ncli := &AcmeCLI{Domains: []string{\"example.com\"}, VerifyType: \"http\"}\ncli.Apply(ctx)\n// after\ncli := &AcmeCLI{Email: \"admin@example.com\", Domains: []string{\"example.com\"}, VerifyType: \"http\"}\nif err := cli.Validate(); err != nil { log.Fatal(err) }\ncli.Apply(ctx)","handlingStrategy":"validation","validationCode":"func requireEmail(email string) error {\n    if strings.TrimSpace(email) == \"\" { return errors.New(\"email is required\") }\n    if !strings.Contains(email, \"@\") { return errors.New(\"email is not a valid address\") }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := cli.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"email is required\") {\n        flag.Usage() // show the missing --email flag\n    }\n    os.Exit(1)\n}","preventionTips":["Always call Validate() before Apply() to fail fast with a clear message","Make --email a required CLI flag (error at parse time)","Source the email from a validated config file or env var","Keep a default ops mailbox for certificate notifications"],"tags":["validation","acme","required-field"],"backgroundTag":"missing-required-argument","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}