glanceapp/glance · error

fetching places data: %v

Error message

fetching places data: %v

What it means

The weather widget's geocoding step failed at the HTTP/decode layer: decodeJsonFromRequest against geocoding-api.open-meteo.com returned an error (network failure or non-200 wrapped by the shared helper). The %v carries the underlying cause, including the helper's status code and body snippet.

Source

Thrown at internal/glance/widget-weather.go:177

	if len(parts) == 1 {
		return name, ""
	}

	if len(parts) == 2 {
		return parts[0] + ", " + expandCountryAbbreviations(parts[1]), ""
	}

	return parts[0] + ", " + expandCountryAbbreviations(parts[2]), strings.TrimSpace(parts[1])
}

func fetchOpenMeteoPlaceFromName(location string) (*openMeteoPlaceResponseJson, error) {
	location, area := parsePlaceName(location)
	requestUrl := fmt.Sprintf("https://geocoding-api.open-meteo.com/v1/search?name=%s&count=20&language=en&format=json", url.QueryEscape(location))
	request, _ := http.NewRequest("GET", requestUrl, nil)
	responseJson, err := decodeJsonFromRequest[openMeteoPlacesResponseJson](defaultHTTPClient, request)
	if err != nil {
		return nil, fmt.Errorf("fetching places data: %v", err)
	}

	if len(responseJson.Results) == 0 {
		return nil, fmt.Errorf("no places found for %s", location)
	}

	var place *openMeteoPlaceResponseJson

	if area != "" {
		area = strings.ToLower(area)

		for i := range responseJson.Results {
			if strings.ToLower(responseJson.Results[i].Area) == area {
				place = &responseJson.Results[i]
				break
			}
		}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Read the nested %v: 'unexpected status code 429 ...' means back off (increase cache-honored refresh), 5xx means upstream outage — retry later
  2. Verify outbound DNS/HTTP from the Glance host: curl 'https://geocoding-api.open-meteo.com/v1/search?name=Amsterdam&count=1'
  3. If egress is proxied, configure Glance's proxy environment variables
Defensive patterns

Strategy: retry

Type guard

func isPlacesFetchErr(err error) bool {
	return err != nil && strings.HasPrefix(err.Error(), "fetching places data")
}

Try / catch

place, err := fetchOpenMeteoPlaceFromName(loc)
if err != nil {
    if isPlacesFetchErr(err) {
        // transient geocoder/network issue: back off and retry, keep last cached forecast meanwhile
        return retryWithBackoff(func() error { place, err = fetchOpenMeteoPlaceFromName(loc); return err })
    }
    return err // 'no places found' variants are config errors, not transient
}

Prevention

When it happens

Trigger: GET https://geocoding-api.open-meteo.com/v1/search?name=... returning non-200 (429 rate limit, 5xx outage) or the request failing at the transport level (DNS failure, no internet, blocked egress).

Common situations: Homelab server without outbound internet during an outage; Open-Meteo rate limiting after aggressive page reloads with a short cache; firewall blocking the geocoding host.

Related errors


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