glanceapp/glance · warning · errPartialContent

%w: could not get %d watches

Error message

%w: could not get %d watches

What it means

Returned from the changedetection widget fetch when at least one (but not all) watch details could not be retrieved: the code counted failures in `failed` and wraps the sentinel errPartialContent with ": could not get %d watches". The successfully fetched watches are still returned alongside the error, so callers can render partial content.

Source

Thrown at internal/glance/widget-changedetection.go:193

			if len(watchJson.PreviousHash) < hashLength {
				hashLength = len(watchJson.PreviousHash)
			}

			watch.PreviousHash = watchJson.PreviousHash[0:hashLength]
		}

		watches = append(watches, watch)
	}

	if len(watches) == 0 {
		return nil, errNoContent
	}

	watches.sortByNewest()

	if failed > 0 {
		return watches, fmt.Errorf("%w: could not get %d watches", errPartialContent, failed)
	}

	return watches, nil
}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Treat it as partial data: the returned slice is valid; render it and surface a warning instead of discarding everything.
  2. Identify the failing watch by fetching each UUID individually and remove/fix the deleted or broken one.
  3. If rate limiting, reduce the number of watches or increase the widget cache duration (cache: 15m).
  4. If persistent, check the changedetection.io instance logs for the failing per-watch request.

Example fix

// before
watches, err := fetchWatchesFromChangeDetection(url, ids, token)
if err != nil {
    return err // drops all successfully fetched watches
}

// after
watches, err := fetchWatchesFromChangeDetection(url, ids, token)
if errors.Is(err, errPartialContent) {
    slog.Warn("partial changedetection content", "error", err)
    // proceed with `watches` (non-nil)
} else if err != nil {
    return err
}
Defensive patterns

Strategy: fallback

Try / catch

watches, err := fetchWatchesFromChangeDetection(url, ids, token)
switch {
case errors.Is(err, errPartialContent):
    // watches is non-nil: render what we got, note the degradation
case errors.Is(err, errNoContent):
    // no watches at all: show empty state
    _ = watches
case err != nil:
    return err
}

Prevention

When it happens

Trigger: fetchWatchesFromChangeDetection loops over requested watch IDs; one per-watch GET times out, returns a non-2xx status, or fails JSON decode while others succeed, incrementing failed and triggering this after sorting.

Common situations: A single watch in the list was deleted server-side (404), transient network hiccup to one request, rate limiting when many watches are configured, instance restarting mid-refresh.

Related errors


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