dgraph-io/dgraph · error

server response: %s

Error message

server response: %s

What it means

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.

Source

Thrown at dgraph/cmd/debuginfo/debugging.go:110

		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

  1. Decode resp.Status in the message and map it: 404 → wrong endpoint/version, 403 → enable access or pass ACL creds, 5xx → server/proxy issue.
  2. Curl the same URL to see the raw response and headers.
  3. Point --alpha/--zero directly at the node (bypass proxies) and use the correct HTTP port.
  4. Upgrade/downgrade the debuginfo tool to match the server's Dgraph version.

Example fix

// before
dgraph debuginfo --alpha https://proxy.example.com/dgraph --metrics cpu
// after
dgraph debuginfo --alpha localhost:8080 --metrics cpu  # direct, correct HTTP port
Defensive patterns

Strategy: try-catch

Validate before calling

resp, err := http.Get(url)
if err != nil { return err }
if resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusForbidden {
    return fmt.Errorf("endpoint %s unavailable (HTTP %d); check version/ACLs", url, resp.StatusCode)
}
resp.Body.Close()

Try / catch

if err := runDebugInfo(); err != nil {
    if s := err.Error(); strings.Contains(s, "404") || strings.Contains(s, "403") {
        // endpoint/ACL problem: fix address or auth before retrying
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/1754b8fc9c1a42b6. Report an issue: GitHub.