{"record":{"id":"034668b4cdbf7715","repo":"anomalyco/sst","slug":"failed-to-create-dns-record-status-d-response","errorCode":null,"errorMessage":"failed to create DNS record, status: %d, response: %s","messagePattern":"failed to create DNS record, status: (.+?), response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/server/resource/cloudflare-dns-record.go","lineNumber":178,"sourceCode":"\t\t\t\t// Check if message contains \"already exists\" regardless of error code\n\t\t\t\tif strings.Contains(strings.ToLower(cfError.Message), \"already exists\") {\n\t\t\t\t\treturn \"existing-record\", nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If not an \"already exists\" error, return the error information\n\t\terrorMsgs := []string{}\n\t\tfor _, cfError := range apiResponse.Errors {\n\t\t\terrorMsgs = append(errorMsgs, fmt.Sprintf(\"%s\", cfError.Message))\n\t\t}\n\t\t\n\t\tif len(errorMsgs) > 0 {\n\t\t\treturn \"\", fmt.Errorf(\"Cloudflare API error: %s\", strings.Join(errorMsgs, \"; \"))\n\t\t}\n\t\t\n\t\t// If we couldn't determine a specific error, return the raw response\n\t\treturn \"\", fmt.Errorf(\"failed to create DNS record, status: %d, response: %s\", resp.StatusCode, string(body))\n\t}\n\t\n\t// Success - return the record ID\n\treturn apiResponse.Result.Id, nil\n}","sourceCodeStart":160,"sourceCodeEnd":183,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/server/resource/cloudflare-dns-record.go#L160-L183","documentation":"This fallback error is returned when the Cloudflare API indicates failure (non-2xx status or success:false) but the response contains no structured errors entries the library can extract. It includes the HTTP status code and the raw response body so the developer can diagnose from the payload itself.","triggerScenarios":"Cloudflare responds with failure but an empty errors array — e.g. HTTP 401/403 auth failures with an unexpected body shape, 429 rate-limit responses, 5xx Cloudflare outages, or HTML/text bodies that still unmarshal (empty struct) but carry no error codes.","commonSituations":"Rate limiting (429) during bulk DNS record creation; expired API token returning an auth HTML page; Cloudflare incident/outage returning 5xx with minimal JSON; a reverse proxy returning an empty or plain-text error body.","solutions":["Inspect the status code and body embedded in the error message","If status 429, back off and retry later; reduce concurrent record creation","If 401/403, rotate or fix the API token and its zone permissions","If 5xx, check the Cloudflare status page and retry after the incident"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight rate/auth sanity check before bulk record creation\nresp, _ := http.Get(\"https://api.cloudflare.com/client/v4/zones/\" + zoneID)\n// 429 or 5xx here predicts this failure; back off before deploying","typeGuard":null,"tryCatchPattern":"_, err := record.Create(input, &out)\nif err != nil && strings.Contains(err.Error(), \"failed to create DNS record, status: 429\") {\n    time.Sleep(backoff) // exponential backoff, then retry\n    _, err = record.Create(input, &out)\n}","preventionTips":["Throttle bulk DNS record creation to avoid 429 rate limits","Check https://www.cloudflarestatus.com before deploying on 5xx errors","Rotate tokens proactively so requests don't hit 401/403 with unexpected bodies","Retry with exponential backoff on non-2xx statuses"],"tags":["cloudflare","dns","http","status-code","fallback"],"backgroundTag":"http-5xx-error","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}