glanceapp/glance · error

loading location: %v

Error message

loading location: %v

What it means

After a geocoding match, time.LoadLocation(place.Timezone) failed: the IANA timezone string returned by Open-Meteo is not loadable by Go on this host. Weather timestamps cannot be rendered in local time without it.

Source

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

		area = strings.ToLower(area)

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

		if place == nil {
			return nil, fmt.Errorf("no place found for %s in %s", location, area)
		}
	} else {
		place = &responseJson.Results[0]
	}

	loc, err := time.LoadLocation(place.Timezone)
	if err != nil {
		return nil, fmt.Errorf("loading location: %v", err)
	}

	place.location = loc

	return place, nil
}

func fetchWeatherForOpenMeteoPlace(place *openMeteoPlaceResponseJson, units string) (*weather, error) {
	query := url.Values{}
	var temperatureUnit string

	if units == "imperial" {
		temperatureUnit = "fahrenheit"
	} else {
		temperatureUnit = "celsius"
	}

	query.Add("latitude", fmt.Sprintf("%f", place.Latitude))

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Install tzdata in the container (e.g. apk add tzdata / apt-get install tzdata) or ensure /usr/share/zoneinfo is present
  2. As a fallback, run with the tzdata-embedded binary or set ZONEINFO to a zoneinfo.zip
  3. If tzdata is present, report the place/timezone pair as an Open-Meteo data issue

Example fix

# before (Dockerfile)
FROM alpine:3.20

# after
FROM alpine:3.20
RUN apk add --no-cache tzdata
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the host can load IANA zones before depending on weather time labels
func tzdataAvailable(sampleZone string) bool {
    _, err := time.LoadLocation(sampleZone) // e.g. "Europe/Amsterdam"
    return err == nil
}

Type guard

func isLoadLocationErr(err error) bool {
	return err != nil && strings.HasPrefix(err.Error(), "loading location")
}

Try / catch

place, err := fetchOpenMeteoPlaceFromName(cfg.Location)
if isLoadLocationErr(err) {
    // environment problem (missing tzdata), not a config problem: fix the image, don't retry
    return fmt.Errorf("host cannot load timezones — install tzdata: %w", err)
}

Prevention

When it happens

Trigger: The geocoder returns an unusual or malformed timezone identifier, or the host lacks the tzdata database (minimal containers like distroless/scratch/alpine without tzdata installed) so even valid zones fail to load.

Common situations: Running Glance in a slim Docker image without the tzdata package; a rare place whose timezone string in Open-Meteo is not a valid IANA zone name.

Related errors


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