glanceapp/glance · error
creating authentication request: %v
Error message
creating authentication request: %v
What it means
Returned by fetchPiholeSessionID when http.NewRequest("POST", instanceURL+"/api/auth", ...) fails before any network I/O. NewRequest fails only on an unparseable URL: unsupported scheme, control characters in the URL, or a malformed host — so this almost always means the configured URL string itself is broken.
Source
Thrown at internal/glance/widget-dns-stats.go:623
PercentBlocked: int(float64(d.Count) / float64(statsResponse.Queries.Blocked) * 100),
})
}
sort.Slice(domains, func(a, b int) bool {
return domains[a].PercentBlocked > domains[b].PercentBlocked
})
stats.TopBlockedDomains = domains[:min(len(domains), 5)]
}
return stats, sessionID, ternary(partialContent, errPartialContent, nil)
}
func fetchPiholeSessionID(instanceURL string, client *http.Client, password string) (string, error) {
requestBody := []byte(`{"password":"` + password + `"}`)
request, err := http.NewRequest("POST", instanceURL+"/api/auth", bytes.NewBuffer(requestBody))
if err != nil {
return "", fmt.Errorf("creating authentication request: %v", err)
}
request.Header.Set("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
return "", fmt.Errorf("sending authentication request: %v", err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
return "", fmt.Errorf("reading authentication response: %v", err)
}
var jsonResponse struct {
Session struct {
SID string `json:"sid"`
Message string `json:"message"`View on GitHub (pinned to 91324e8de7)
Solutions
- Inspect the widget's url value for typos, missing scheme, spaces, or bad interpolation.
- Always include the scheme: http://pihole.local or https://...
- Quote the URL in YAML if it contains special characters.
- Test with url.Parse in Go or simply curl the same string.
Example fix
# before url: pihole.local:80 # after url: http://pihole.local:80
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(widget.URL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return fmt.Errorf("dns-stats: url must be a valid http(s) URL, got %q", widget.URL)
} Prevention
- Always configure full URLs with scheme (http:// or https://).
- Quote YAML URL values containing special characters.
- Fail config validation on empty/scheme-less URLs before runtime.
When it happens
Trigger: url containing spaces or control characters, a scheme like ftp:// or missing entirely (no http://), or a password/URL concatenation producing invalid characters in the request line.
Common situations: YAML value with a trailing space or unquoted special characters; copy-pasted URL missing the scheme; environment-variable-substituted URL that rendered empty or malformed.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- parsing proxy URL: %v
- service must be one of: %s, %s, %s, %s
- fetching session ID: %v
- checking session ID: %v
- renewing session ID: %v
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/82442e92b7b291a2.
Report an issue: GitHub.