{"record":{"id":"c2d93243314467a3","repo":"wtfutil/wtf","slug":"failed-to-retrieve-version-from-pi-hole-server-h","errorCode":null,"errorMessage":" failed to retrieve version from Pi-hole server\n http status code: %d","messagePattern":" failed to retrieve version from Pi-hole server\n http status code: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/pihole/client.go","lineNumber":68,"sourceCode":"\turl.RawQuery = query.Encode()\n\tif req, err = http.NewRequest(\"GET\", url.String(), http.NoBody); err != nil {\n\t\treturn status, fmt.Errorf(\" failed to create request\\n %s\", parseError(err))\n\t}\n\n\tvar resp *http.Response\n\n\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","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/pihole/client.go#L50-L86","documentation":"Raised in getStatus when the Pi-hole server responds with an HTTP status >= 400 (Bad Request or worse) to the summary API request. The request reached the server but was rejected — e.g. wrong API path, blocked endpoint, or server-side error.","triggerScenarios":"Thrown at modules/pihole/client.go:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the apiUrl points to the correct Pi-hole API endpoint (usually .../admin/api.php)","Verify any required auth (webpassword) is configured correctly","Inspect the configured URL path for typos causing 404s","Check Pi-hole server logs for the rejected request"],"exampleFix":null,"handlingStrategy":"fallback","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"}