{"record":{"id":"40e7024e0e30d57c","repo":"wtfutil/wtf","slug":"failed-to-parse-api-url-s","errorCode":null,"errorMessage":" failed to parse API URL\n %s","messagePattern":" failed to parse API URL\n (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/pihole/client.go","lineNumber":39,"sourceCode":"\tQueriesForwarded    string `json:\"queries_forwarded\"`\n\tQueriesCached       string `json:\"queries_cached\"`\n\tStatus              string `json:\"status\"`\n\tGravityLastUpdated  struct {\n\t\tRelative struct {\n\t\t\tDays    FlexInt `json:\"days\"`\n\t\t\tHours   FlexInt `json:\"hours\"`\n\t\t\tMinutes FlexInt `json:\"minutes\"`\n\t\t}\n\t} `json:\"gravity_last_updated\"`\n}\n\nfunc getStatus(c http.Client, apiURL string) (status Status, err error) {\n\tvar req *http.Request\n\n\tvar url *url2.URL\n\n\tif url, err = url2.Parse(apiURL); err != nil {\n\t\treturn status, fmt.Errorf(\" failed to parse API URL\\n %s\", parseError(err))\n\t}\n\n\tvar query url2.Values\n\n\tif query, err = url2.ParseQuery(url.RawQuery); err != nil {\n\t\treturn status, fmt.Errorf(\" failed to parse query\\n %s\", parseError(err))\n\t}\n\n\tquery.Add(\"summary\", \"\")\n\n\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 {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/pihole/client.go#L21-L57","documentation":"Guard in getStatus fired when url.Parse cannot parse the configured apiURL, meaning the Pi-hole API URL string is malformed (bad scheme, invalid characters, etc.). Fetching the Pi-hole status cannot proceed without a valid URL, so the parse error is embedded via parseError and returned; getSummaryView surfaces it in the module. Fix by correcting the apiURL setting (e.g. a proper http://host:port/api endpoint).","triggerScenarios":"Thrown at modules/pihole/client.go:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the apiUrl setting so it is a well-formed URL (e.g. http://pi.hole/admin/api.php)","Check for missing scheme, stray spaces, or unescaped characters in the configured URL","Test the URL in a browser or with curl before putting it in config"],"exampleFix":null,"handlingStrategy":"validation","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"}