{"record":{"id":"c75861c19188fd29","repo":"wtfutil/wtf","slug":"failed-to-read-status-response","errorCode":null,"errorMessage":" failed to read status response","messagePattern":" failed to read status response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/pihole/client.go","lineNumber":75,"sourceCode":"\tif resp, err = c.Do(req); err != nil || resp == nil {\n\t\treturn status, fmt.Errorf(\" failed to connect to Pi-hole server\\n %s\", parseError(err))\n\t}\n\n\tdefer func() {\n\t\tif closeErr := resp.Body.Close(); closeErr != nil {\n\t\t\treturn\n\t\t}\n\t}()\n\n\tif resp.StatusCode >= http.StatusBadRequest {\n\t\treturn status, fmt.Errorf(\" failed to retrieve version from Pi-hole server\\n http status code: %d\",\n\t\t\tresp.StatusCode)\n\t}\n\n\tvar rBody []byte\n\n\tif rBody, err = io.ReadAll(resp.Body); err != nil {\n\t\treturn status, fmt.Errorf(\" failed to read status response\")\n\t}\n\n\tif err = json.Unmarshal(rBody, &status); err != nil {\n\t\treturn status, fmt.Errorf(\" failed to retrieve status: check provided api URL and token\\n %s\",\n\t\t\tparseError(err))\n\t}\n\n\treturn status, err\n}\n\ntype FlexInt int\n\nfunc (fi *FlexInt) UnmarshalJSON(b []byte) error {\n\tif b[0] != '\"' {\n\t\treturn json.Unmarshal(b, (*int)(fi))\n\t}\n\n\tvar s string","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/pihole/client.go#L57-L93","documentation":"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.","triggerScenarios":"Thrown at modules/pihole/client.go:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request — transient network interruptions often resolve themselves","Check network stability between the host and the Pi-hole server","Verify the Pi-hole server is not crashing or restarting mid-response"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}