wtfutil/wtf · error
failed to parse query %s
Error message
failed to parse query %s
What it means
Raised in getStatus when url2.ParseQuery fails on the raw query portion of the configured Pi-hole API URL — the URL's query string is malformed (e.g. bad percent-encoding or a malformed parameter), so the request cannot be assembled.
Source
Thrown at modules/pihole/client.go:45
Hours FlexInt `json:"hours"`
Minutes FlexInt `json:"minutes"`
}
} `json:"gravity_last_updated"`
}
func getStatus(c http.Client, apiURL string) (status Status, err error) {
var req *http.Request
var url *url2.URL
if url, err = url2.Parse(apiURL); err != nil {
return status, fmt.Errorf(" failed to parse API URL\n %s", parseError(err))
}
var query url2.Values
if query, err = url2.ParseQuery(url.RawQuery); err != nil {
return status, fmt.Errorf(" failed to parse query\n %s", parseError(err))
}
query.Add("summary", "")
url.RawQuery = query.Encode()
if req, err = http.NewRequest("GET", url.String(), http.NoBody); err != nil {
return status, fmt.Errorf(" failed to create request\n %s", parseError(err))
}
var resp *http.Response
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 {
returnView on GitHub (pinned to bb838c1ccb)
Solutions
- Fix the query string in the configured apiUrl — ensure valid percent-encoding and key=value pairs
- Remove or correct malformed URL parameters in the config
- Simplify the apiUrl to a base endpoint and let the widget append its own parameters
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/pihole/client.go:45 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/c5fe34c34d5f3527.
Report an issue: GitHub.