glanceapp/glance · error

non-200 response status: %s

Error message

non-200 response status: %s

What it means

The Docker API answered the /containers/json request with a status other than 200. The response status string is included. Typical codes: 500 (daemon error), 401/403 (TLS client-cert or auth proxy rejection), or a proxy error page (502) when something other than Docker listens on the target.

Source

Thrown at internal/glance/widget-docker-containers.go:332


	fetchAll := ternary(runningOnly, "false", "true")
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	request, err := http.NewRequestWithContext(ctx, "GET", "http://"+hostname+"/containers/json?all="+fetchAll, nil)
	if err != nil {
		return nil, fmt.Errorf("creating request: %w", err)
	}

	response, err := client.Do(request)
	if err != nil {
		return nil, fmt.Errorf("sending request to socket: %w", err)
	}
	defer response.Body.Close()

	if response.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("non-200 response status: %s", response.Status)
	}

	var containers []dockerContainerJsonResponse
	if err := json.NewDecoder(response.Body).Decode(&containers); err != nil {
		return nil, fmt.Errorf("decoding response: %w", err)
	}

	for i := range containers {
		container := &containers[i]
		name := strings.TrimLeft(itemAtIndexOrDefault(container.Names, 0, ""), "/")

		if name == "" {
			continue
		}

		overrides, ok := labelOverrides[name]
		if !ok {
			continue

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Reproduce manually: curl --unix-socket /var/run/docker.sock http://localhost/containers/json or curl http://host:2375/containers/json
  2. If the endpoint is TLS-secured, use the correct scheme/port and ensure the daemon is configured to accept your client
  3. Confirm the port actually serves the Docker API and not a web proxy
  4. Check 'dockerd' logs for the underlying 500 cause

Example fix

# before
  host: tcp://my-server:443
# after (point directly at the Docker API port)
  host: tcp://my-server:2375
Defensive patterns

Strategy: validation

Validate before calling

req, _ := http.NewRequest("GET", "http://"+hostname+"/version", nil)
resp, err := client.Do(req)
if err != nil || resp.StatusCode != 200 {
    // endpoint is not a reachable Docker API; fix source before enabling widget
}

Try / catch

if strings.Contains(err.Error(), "non-200 response status") {
    slog.Error("docker API rejected request — check TLS/proxy on the source", "host", hostname)
}

Prevention

When it happens

Trigger: Docker daemon internal error (500); TLS-secured endpoint expecting client certificates; pointing tcp:// at a reverse proxy or non-Docker service; API version mismatch on very old daemons.

Common situations: Source URL points at a port serving Traefik/nginx instead of the Docker API; Docker daemon over TLS requiring --tlscert; Docker in a crash-looping state.

Related errors


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