glanceapp/glance · error

sending authentication request: %v

Error message

sending authentication request: %v

What it means

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.

Source

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

		})
		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"`
		} `json:"session"`
	}

	if err := json.Unmarshal(body, &jsonResponse); err != nil {
		return "", fmt.Errorf("parsing authentication response: %v", err)
	}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. From the glance host, curl {url}/api/auth to confirm reachability and TLS.
  2. For self-signed certificates set allow-insecure: true (lab use) or install/trust the CA.
  3. Fix hostname/IP or start the Pi-hole service if stopped.
  4. Check Docker networking (bridge vs host) when glance runs containerized.

Example fix

# before
- type: dns-stats
  service: pihole_v6
  url: https://pihole.internal

# after
- type: dns-stats
  service: pihole_v6
  url: https://pihole.internal
  allow-insecure: true
Defensive patterns

Strategy: retry

Validate before calling

// reachability preflight before enabling the widget
conn, err := net.DialTimeout("tcp", hostPort(widget.URL), 3*time.Second)
if err != nil {
    return fmt.Errorf("pihole unreachable: %v", err)
}
conn.Close()

Try / catch

if err != nil && strings.Contains(err.Error(), "sending authentication request") {
    // transport failure: DNS/TCP/TLS — retry on next refresh, check allow-insecure
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


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