{"record":{"id":"1754b8fc9c1a42b6","repo":"dgraph-io/dgraph","slug":"server-response-s","errorCode":null,"errorMessage":"server response: %s","messagePattern":"server response: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dgraph/cmd/debuginfo/debugging.go","lineNumber":110,"sourceCode":"\t\tdefer func() {\n\t\t\tif err := resp.Body.Close(); err != nil {\n\t\t\t\tglog.Warningf(\"error closing body: %v\", err)\n\t\t\t}\n\t\t}()\n\t\treturn nil, statusCodeError(resp)\n\t}\n\n\treturn resp.Body, nil\n}\n\nfunc statusCodeError(resp *http.Response) error {\n\tif resp.Header.Get(\"X-Go-Pprof\") != \"\" &&\n\t\tstrings.Contains(resp.Header.Get(\"Content-Type\"), \"text/plain\") {\n\t\tif body, err := io.ReadAll(resp.Body); err == nil {\n\t\t\treturn fmt.Errorf(\"server response: %s - %s\", resp.Status, body)\n\t\t}\n\t}\n\treturn fmt.Errorf(\"server response: %s\", resp.Status)\n}\n","sourceCodeStart":92,"sourceCodeEnd":112,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/dgraph/cmd/debuginfo/debugging.go#L92-L112","documentation":"Fallback branch of statusCodeError: the server returned a non-200 status without a Go pprof text/plain payload, so the error only carries the HTTP status line (e.g. 'server response: 404 Not Found'). It tells you the debug endpoint exists-or-not at the HTTP level but gives no body detail.","triggerScenarios":"fetchURL receives any non-OK status where X-Go-Pprof header is absent or Content-Type is not text/plain — e.g. 404 from a wrong path, 403 from an ACL-protected endpoint, 502 from a proxy.","commonSituations":"Misconfigured --alpha address behind a reverse proxy, ACL/security mode blocking /debug endpoints, Dgraph version where the endpoint was renamed or removed, load balancer returning 502/503.","solutions":["Decode resp.Status in the message and map it: 404 → wrong endpoint/version, 403 → enable access or pass ACL creds, 5xx → server/proxy issue.","Curl the same URL to see the raw response and headers.","Point --alpha/--zero directly at the node (bypass proxies) and use the correct HTTP port.","Upgrade/downgrade the debuginfo tool to match the server's Dgraph version."],"exampleFix":"// before\ndgraph debuginfo --alpha https://proxy.example.com/dgraph --metrics cpu\n// after\ndgraph debuginfo --alpha localhost:8080 --metrics cpu  # direct, correct HTTP port","handlingStrategy":"try-catch","validationCode":"resp, err := http.Get(url)\nif err != nil { return err }\nif resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusForbidden {\n    return fmt.Errorf(\"endpoint %s unavailable (HTTP %d); check version/ACLs\", url, resp.StatusCode)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"if err := runDebugInfo(); err != nil {\n    if s := err.Error(); strings.Contains(s, \"404\") || strings.Contains(s, \"403\") {\n        // endpoint/ACL problem: fix address or auth before retrying\n    }\n    return err\n}","preventionTips":["Bypass reverse proxies; target the node directly for debug collection.","Enable/pass ACL credentials when security mode is on.","Confirm endpoint names for your Dgraph version (they change between releases).","Handle 5xx from LBs by retrying against a healthy node."],"tags":["http","network","debuginfo"],"backgroundTag":"http-non-200-response","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}