glanceapp/glance · error

checking session ID: %v

Error message

checking session ID: %v

What it means

Returned by the Pi-hole v6 stats fetcher when a previously cached session ID exists but checkPiholeSessionIDIsValid (GET /api/auth with the SID) itself errored — i.e. the validity check could not be performed due to a transport or decoding failure, as opposed to the session simply being expired (which would silently renew instead).

Source

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

	fetchNewSessionID := func() error {
		newSessionID, err := fetchPiholeSessionID(instanceURL, client, password)
		if err != nil {
			return err
		}
		sessionID = newSessionID
		return nil
	}

	if sessionID == "" {
		if err := fetchNewSessionID(); err != nil {
			slog.Error("Failed to fetch Pihole v6 session ID", "error", err)
			return nil, "", fmt.Errorf("fetching session ID: %v", err)
		}
	} else {
		isValid, err := checkPiholeSessionIDIsValid(instanceURL, client, sessionID)
		if err != nil {
			slog.Error("Failed to check Pihole v6 session ID validity", "error", err)
			return nil, "", fmt.Errorf("checking session ID: %v", err)
		}

		if !isValid {
			if err := fetchNewSessionID(); err != nil {
				slog.Error("Failed to renew Pihole v6 session ID", "error", err)
				return nil, "", fmt.Errorf("renewing session ID: %v", err)
			}
		}
	}

	var wg sync.WaitGroup
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	type statsResponseJson struct {
		Queries struct {
			Total          int     `json:"total"`
			Blocked        int     `json:"blocked"`

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Check Pi-hole is up and reachable from the glance host when the error occurs.
  2. If it recurs after every Pi-hole restart, the cached SID becomes invalid — a restart of glance (or waiting for cache expiry) forces a fresh fetch.
  3. Stabilize the reverse proxy/network path if intermittent 502s are the cause.
Defensive patterns

Strategy: try-catch

Try / catch

stats, sid, err := fetchPiholeV6Stats(...)
if err != nil {
    if strings.HasPrefix(err.Error(), "checking session ID") {
        // transport-level failure of the validity check: retry on next refresh,
        // do not wipe the cached SID (it may still be valid)
    }
}

Prevention

When it happens

Trigger: GET {url}/api/auth with the stored SID fails at the HTTP layer: connection refused mid-run, DNS failure, TLS handshake error, timeout, or a response body that cannot be processed.

Common situations: Pi-hole restarted or became unreachable between the initial auth and the stats fetch; flaky link; reverse proxy briefly returning 502 pages; the SID cache outliving a Pi-hole restart.

Related errors


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