glanceapp/glance · error

session ID check request returned status %s

Error message

session ID check request returned status %s

What it means

After calling GET <instanceURL>/api/auth with the x-ftl-sid header, Pi-hole returned an HTTP status other than 200 (valid session) or 401 (expired session). Any other status (e.g. 500, 502, 404) is treated as an unexpected condition and reported with the raw response status string.

Source

Thrown at internal/glance/widget-dns-stats.go:680

	return jsonResponse.Session.SID, nil
}

func checkPiholeSessionIDIsValid(instanceURL string, client *http.Client, sessionID string) (bool, error) {
	request, err := http.NewRequest("GET", instanceURL+"/api/auth", nil)
	if err != nil {
		return false, fmt.Errorf("creating session ID check request: %v", err)
	}
	request.Header.Set("x-ftl-sid", sessionID)

	response, err := client.Do(request)
	if err != nil {
		return false, err
	}
	defer response.Body.Close()

	if response.StatusCode != http.StatusOK && response.StatusCode != http.StatusUnauthorized {
		return false, fmt.Errorf("session ID check request returned status %s", response.Status)
	}

	return response.StatusCode == http.StatusOK, nil
}

type technitiumStatsResponse struct {
	Response struct {
		Stats struct {
			TotalQueries   int `json:"totalQueries"`
			BlockedQueries int `json:"totalBlocked"`
			BlockedZones   int `json:"blockedZones"`
			BlockListZones int `json:"blockListZones"`
		} `json:"stats"`
		MainChartData struct {
			Datasets []struct {
				Label string `json:"label"`
				Data  []int  `json:"data"`
			} `json:"datasets"`

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Verify Pi-hole is v6+ and reachable: curl -i <instanceURL>/api/auth should return 200 or 401
  2. If a reverse proxy is configured, check its upstream routing and that the Pi-hole container/service is up
  3. Ensure the url: field points at the Pi-hole base (e.g. http://pi.hole) without extra paths
  4. Check Pi-hole FTL logs (pihole-FTL.log) for crashes if it returns 500
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Get(instanceURL + "/api/auth") // smoke test
if err != nil || (resp.StatusCode != 200 && resp.StatusCode != 401) {
    // endpoint not speaking the Pi-hole v6 API; fix URL/proxy before enabling the widget
}

Try / catch

ok, err := checkPiholeSessionIDIsValid(instanceURL, client, sid)
if err != nil {
    // treat as transient: skip authed queries this cycle, retry next update
    slog.Warn("pi-hole session check error", "error", err)
    return
}
if !ok {
    // session expired: re-authenticate
}

Prevention

When it happens

Trigger: Pi-hole API returns 404 (wrong URL path / not a Pi-hole v6 API), 500 (Pi-hole FTL crash), 502/503 (reverse proxy in front of Pi-hole is down or misrouting), or a redirect target that answers with a non-200/401 code.

Common situations: Pointing the widget at a Pi-hole v5 instance (which lacks /api/auth); a reverse proxy (nginx/Traefik) returning 502 because the upstream is down; pointing at the admin UI base path instead of the API host; Pi-hole FTL service restarting.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/60223d26ef52704d. Report an issue: GitHub.