dgraph-io/dgraph · error
server response: %s - %s
Error message
server response: %s - %s
What it means
statusCodeError wraps a non-200 HTTP response from a debug/profile endpoint. When the server responds with a Go pprof marker header (X-Go-Pprof) and a text/plain body, the body is read and appended because it contains the actual pprof error message (e.g. profile unavailable). Otherwise only the HTTP status line is reported.
Source
Thrown at dgraph/cmd/debuginfo/debugging.go:107
return nil, fmt.Errorf("http fetch: %v", err)
}
if resp.StatusCode != http.StatusOK {
defer func() {
if err := resp.Body.Close(); err != nil {
glog.Warningf("error closing body: %v", err)
}
}()
return nil, statusCodeError(resp)
}
return resp.Body, nil
}
func statusCodeError(resp *http.Response) error {
if resp.Header.Get("X-Go-Pprof") != "" &&
strings.Contains(resp.Header.Get("Content-Type"), "text/plain") {
if body, err := io.ReadAll(resp.Body); err == nil {
return fmt.Errorf("server response: %s - %s", resp.Status, body)
}
}
return fmt.Errorf("server response: %s", resp.Status)
}
View on GitHub (pinned to 759e242be6)
Solutions
- Check the endpoint URL and port: the debuginfo --alpha/--zero flags must point to the correct HTTP (8080/6080) port.
- Read the appended body in the error message — for pprof responses it states the server-side reason; fix accordingly (e.g. wait for an active profile to finish).
- Verify the Alpha/Zero is healthy and supports the requested profile endpoint (curl http://<addr>/debug/pprof/).
- Align Dgraph versions so all requested profiles/metrics exist on the server.
Example fix
// before
cmd := exec.Command("dgraph", "debuginfo", "--alpha", "localhost:9080") // wrong port (gRPC)
// after
cmd := exec.Command("dgraph", "debuginfo", "--alpha", "localhost:8080") // HTTP port Defensive patterns
Strategy: try-catch
Validate before calling
resp, err := http.Get(url)
if err != nil { return err }
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("profile endpoint %s -> %d: %s", url, resp.StatusCode, body)
}
resp.Body.Close() Try / catch
if err := dgraphDebugInfoRun(...); err != nil {
var statusErr interface{ Error() string }
if strings.HasPrefix(err.Error(), "server response: ") {
// parse status and appended pprof body; log endpoint + status
glog.Errorf("debuginfo fetch failed: %v", err)
}
return err
} Prevention
- Point --alpha/--zero at the correct HTTP port (8080/6080), not gRPC.
- Curl the pprof endpoints before running debuginfo to confirm availability.
- Avoid running debuginfo while another profile is active on the node.
- Keep Dgraph tool and server versions aligned.
When it happens
Trigger: dgraph debuginfo (or any fetchURL caller) hits /debug/pprof/* or /debug/vars style endpoints and the Alpha/Zero returns a non-200 status; fetchURL passes the response to statusCodeError.
Common situations: Profiling disabled or unavailable on the target node, requesting a profile that the runtime cannot produce (e.g. profile already active, CPU profiling in progress), wrong port (query HTTP port vs internal port), older/newer Dgraph version exposing different endpoints.
Related errors
- server response: %s
- http fetch: %v
- error while creating temporary directory: %s
- failed to connect to endpoint [%s]: %w
- failed to disable drain mode: %v
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/69bfd8ace4635acc.
Report an issue: GitHub.