wtfutil/wtf · error

failed to read status response

Error message

 failed to read status response

What it means

Raised in getStatus when io.ReadAll fails on the Pi-hole response body — the connection delivered headers but the body could not be fully read, typically due to the connection being interrupted or reset mid-transfer.

Source

Thrown at modules/pihole/client.go:75

	if resp, err = c.Do(req); err != nil || resp == nil {
		return status, fmt.Errorf(" failed to connect to Pi-hole server\n %s", parseError(err))
	}

	defer func() {
		if closeErr := resp.Body.Close(); closeErr != nil {
			return
		}
	}()

	if resp.StatusCode >= http.StatusBadRequest {
		return status, fmt.Errorf(" failed to retrieve version from Pi-hole server\n http status code: %d",
			resp.StatusCode)
	}

	var rBody []byte

	if rBody, err = io.ReadAll(resp.Body); err != nil {
		return status, fmt.Errorf(" failed to read status response")
	}

	if err = json.Unmarshal(rBody, &status); err != nil {
		return status, fmt.Errorf(" failed to retrieve status: check provided api URL and token\n %s",
			parseError(err))
	}

	return status, err
}

type FlexInt int

func (fi *FlexInt) UnmarshalJSON(b []byte) error {
	if b[0] != '"' {
		return json.Unmarshal(b, (*int)(fi))
	}

	var s string

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Retry the request — transient network interruptions often resolve themselves
  2. Check network stability between the host and the Pi-hole server
  3. Verify the Pi-hole server is not crashing or restarting mid-response
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at modules/pihole/client.go:75 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/c75861c19188fd29. Report an issue: GitHub.