Billionmail/BillionMail · error
domain %s does not exist
Error message
domain %s does not exist
What it means
SetSSL refuses to configure SSL for a domain that is not registered in the system. Before creating the SNI certificate, the controller calls domains.Exists(ctx, req.Domain) to confirm the domain row is present; if not, it aborts with this error. It prevents setting SSL certificates for arbitrary or mistyped domains that the mail stack does not manage.
Source
Thrown at core/internal/controller/domains/domains_v1_set_ssl.go:23
"billionmail-core/internal/service/domains"
"billionmail-core/internal/service/mail_service"
"billionmail-core/internal/service/public"
"context"
"fmt"
"billionmail-core/api/domains/v1"
)
func (c *ControllerV1) SetSSL(ctx context.Context, req *v1.SetSSLReq) (res *v1.SetSSLRes, err error) {
res = &v1.SetSSLRes{}
if ex, err1 := domains.Exists(ctx, req.Domain); !ex {
if err1 != nil {
res.SetError(fmt.Errorf("fail to check domain: %w", err1))
return
}
res.SetError(fmt.Errorf("domain %s does not exist", req.Domain))
return
}
crt := mail_service.NewCertificate()
defer crt.Close()
err = crt.SetSNI(public.FormatMX(req.Domain), req.Certificate, req.Key)
if err != nil {
res.SetError(fmt.Errorf("fail to set ssl: %w", err))
return
}
_ = public.WriteLog(ctx, public.LogParams{
Type: consts.LOGTYPE.Domain,
Log: "Set SSL for domain :" + req.Domain + " successfully",
Data: req,View on GitHub (pinned to fc36c76c05)
Solutions
- Add the domain first via the domains create API, then retry SetSSL.
- Verify the exact stored domain string (list domains) and correct req.Domain, including case and trailing characters.
- If 'fail to check domain' accompanies it, resolve the underlying DB error surfaced by that wrapper first.
Example fix
// before
curl -X POST /api/v1/domains/ssl -d '{"domain":"exmaple.com", ...}'
// after
curl -X POST /api/v1/domains/ssl -d '{"domain":"example.com", ...}' // domain added beforehand Defensive patterns
Strategy: validation
Validate before calling
// Go: confirm the domain exists before calling SetSSL
exists, err := domainsClient.Exists(ctx, domain)
if err != nil || !exists {
return fmt.Errorf("domain %s must be added before setting SSL", domain)
} Try / catch
if err := setSSL(domain, cert, key); err != nil {
if strings.Contains(err.Error(), "does not exist") {
// create the domain, then retry once
}
return err
} Prevention
- Always create/list the domain before configuring SSL for it.
- Normalize domain input (trim, lowercase, strip trailing dot) before sending.
- Copy the domain string from the domains list API rather than retyping it.
When it happens
Trigger: Calling the SetSSL API with req.Domain spelled differently from the stored domain (e.g. missing subdomain, trailing dot, uppercase), or calling it after the domain was deleted, or before the domain was added via the domains API.
Common situations: Typos in the domain name; using the bare zone apex when a subdomain is registered (or vice versa); a race where another admin removed the domain; operating against a fresh install where domains have not been imported yet.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- fail to check domain: %w
- failed to get all domains: %w
- fail to set ssl: %w
- No log files found
- no log files found
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/3ab9946a8af03010.
Report an issue: GitHub.