{"record":{"id":"4c018b83cc1be848","repo":"caddyserver/caddy","slug":"forming-request-v","errorCode":null,"errorMessage":"forming request: %v","messagePattern":"forming request: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/acmeissuer.go","lineNumber":380,"sourceCode":"// generateZeroSSLEABCredentials generates ZeroSSL EAB credentials for the primary contact email\n// on the issuer. It should only be usedif the CA endpoint is ZeroSSL. An email address is required.\nfunc (iss *ACMEIssuer) generateZeroSSLEABCredentials(ctx context.Context, acct acme.Account) (*acme.EAB, acme.Account, error) {\n\tif strings.TrimSpace(iss.Email) == \"\" {\n\t\treturn nil, acme.Account{}, fmt.Errorf(\"your email address is required to use ZeroSSL's ACME endpoint\")\n\t}\n\n\tif len(acct.Contact) == 0 {\n\t\t// we borrow the email from config or the default email, so ensure it's saved with the account\n\t\tacct.Contact = []string{\"mailto:\" + iss.Email}\n\t}\n\n\tendpoint := zerossl.BaseURL + \"/acme/eab-credentials-email\"\n\tform := url.Values{\"email\": []string{iss.Email}}\n\tbody := strings.NewReader(form.Encode())\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, body)\n\tif err != nil {\n\t\treturn nil, acct, fmt.Errorf(\"forming request: %v\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Set(\"User-Agent\", certmagic.UserAgent)\n\n\tresp, err := http.DefaultClient.Do(req) //nolint:gosec // no SSRF since URL is from trusted config\n\tif err != nil {\n\t\treturn nil, acct, fmt.Errorf(\"performing EAB credentials request: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result struct {\n\t\tSuccess bool `json:\"success\"`\n\t\tError   struct {\n\t\t\tCode int    `json:\"code\"`\n\t\t\tType string `json:\"type\"`\n\t\t} `json:\"error\"`\n\t\tEABKID     string `json:\"eab_kid\"`\n\t\tEABHMACKey string `json:\"eab_hmac_key\"`","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/acmeissuer.go#L362-L398","documentation":"While fetching ZeroSSL EAB credentials, http.NewRequestWithContext failed to build the POST request to https://app.zerossl.com/acme/eab-credentials-email. This step only parses the URL and method, so failure indicates a malformed URL or an invalid context rather than a network problem. In practice it is almost impossible to hit unless the zerossl.BaseURL constant or the request context is bad.","triggerScenarios":"A cancelled or malformed context passed into the ACME registration flow, or a build of Caddy/plugins where zerossl.BaseURL was modified/overridden to an unparseable URL.","commonSituations":"Rare. Typically only seen with forks that override the ZeroSSL base URL, or when the enclosing operation's context is already cancelled before the EAB call.","solutions":["Check the wrapped error message: if it mentions 'context canceled', ensure the server is not shutting down mid-issuance and retry issuance.","If running a fork or custom build, verify zerossl.BaseURL is a valid absolute URL (scheme + host).","Retry the operation; transient shutdown races are the most common real cause."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"u, err := url.Parse(zerossl.BaseURL)\nif err != nil || !u.IsAbs() {\n    return fmt.Errorf(\"invalid ZeroSSL base URL: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := issuer.Register(ctx); err != nil {\n    if strings.Contains(err.Error(), \"forming request\") {\n        // context or URL issue, not network; check shutdown state and retry once\n        time.Sleep(time.Second)\n        err = issuer.Register(ctx)\n    }\n}","preventionTips":["Do not modify zerossl.BaseURL in forks without validating it parses.","Avoid cancelling contexts that wrap ACME registration unless shutting down."],"tags":["tls","acme","zerossl","http"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}