{"record":{"id":"86e524bcea114085","repo":"glanceapp/glance","slug":"sending-authentication-request-v","errorCode":null,"errorMessage":"sending authentication request: %v","messagePattern":"sending authentication request: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget-dns-stats.go","lineNumber":629,"sourceCode":"\t\t})\n\t\tstats.TopBlockedDomains = domains[:min(len(domains), 5)]\n\t}\n\n\treturn stats, sessionID, ternary(partialContent, errPartialContent, nil)\n}\n\nfunc fetchPiholeSessionID(instanceURL string, client *http.Client, password string) (string, error) {\n\trequestBody := []byte(`{\"password\":\"` + password + `\"}`)\n\n\trequest, err := http.NewRequest(\"POST\", instanceURL+\"/api/auth\", bytes.NewBuffer(requestBody))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"creating authentication request: %v\", err)\n\t}\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"sending authentication request: %v\", err)\n\t}\n\tdefer response.Body.Close()\n\n\tbody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading authentication response: %v\", err)\n\t}\n\n\tvar jsonResponse struct {\n\t\tSession struct {\n\t\t\tSID     string `json:\"sid\"`\n\t\t\tMessage string `json:\"message\"`\n\t\t} `json:\"session\"`\n\t}\n\n\tif err := json.Unmarshal(body, &jsonResponse); err != nil {\n\t\treturn \"\", fmt.Errorf(\"parsing authentication response: %v\", err)\n\t}","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-dns-stats.go#L611-L647","documentation":"Returned by fetchPiholeSessionID when client.Do(request) fails sending POST {url}/api/auth. This is the transport-level failure: DNS resolution, TCP connection, TLS handshake, timeout, or connection reset — the request was well-formed but could not be delivered/completed.","triggerScenarios":"Pi-hole host down or unreachable, DNS name not resolving, TLS certificate error (self-signed without allow-insecure), firewall dropping the connection, or the client timeout expiring.","commonSituations":"Wrong hostname/IP in the widget config; Pi-hole container stopped; glance running in Docker with no route to a LAN IP; self-signed cert with allow-insecure not set.","solutions":["From the glance host, curl {url}/api/auth to confirm reachability and TLS.","For self-signed certificates set allow-insecure: true (lab use) or install/trust the CA.","Fix hostname/IP or start the Pi-hole service if stopped.","Check Docker networking (bridge vs host) when glance runs containerized."],"exampleFix":"# before\n- type: dns-stats\n  service: pihole_v6\n  url: https://pihole.internal\n\n# after\n- type: dns-stats\n  service: pihole_v6\n  url: https://pihole.internal\n  allow-insecure: true","handlingStrategy":"retry","validationCode":"// reachability preflight before enabling the widget\nconn, err := net.DialTimeout(\"tcp\", hostPort(widget.URL), 3*time.Second)\nif err != nil {\n    return fmt.Errorf(\"pihole unreachable: %v\", err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"sending authentication request\") {\n    // transport failure: DNS/TCP/TLS — retry on next refresh, check allow-insecure\n}","preventionTips":["Set allow-insecure: true for self-signed labs; trust the CA in production.","Verify container networking can reach LAN IPs (host network or routes).","Monitor the Pi-hole host so outages are detected outside glance."],"tags":["network","tls","pihole","dns-stats"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}