glanceapp/glance · error

no places found for %s

Error message

no places found for %s

What it means

The Open-Meteo geocoding API responded successfully but contained zero results for the location string. The name (after parsePlaceName stripped any area qualifier) does not match any known place in Open-Meteo's geocoder.

Source

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

	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
			}
		}

		if place == nil {
			return nil, fmt.Errorf("no place found for %s in %s", location, area)
		}
	} else {

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Test the name directly: curl 'https://geocoding-api.open-meteo.com/v1/search?name=YOURNAME&count=20&language=en&format=json' — if results is empty, the name is the problem
  2. Use the canonical English spelling or the 'City, Country' form
  3. For ambiguous names, use the 'City, Area' form (e.g. 'Portland, Oregon') so the area filter can disambiguate

Example fix

# before
location: Amsterdaam

# after
location: Amsterdam, Netherlands
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight a location string against the same geocoder the widget uses
func locationResolves(name string) bool {
    u := fmt.Sprintf("https://geocoding-api.open-meteo.com/v1/search?name=%s&count=1&format=json", url.QueryEscape(name))
    resp, err := http.Get(u)
    if err != nil { return false }
    defer resp.Body.Close()
    var r struct{ Results []struct{} `json:"results"` }
    _ = json.NewDecoder(resp.Body).Decode(&r)
    return len(r.Results) > 0
}

Type guard

func isNoPlacesFound(err error) bool {
	return err != nil && strings.HasPrefix(err.Error(), "no places found for")
}

Try / catch

place, err := fetchOpenMeteoPlaceFromName(cfg.Location)
if isNoPlacesFound(err) {
    // authoring error: surface to the user instead of retrying
    return fmt.Errorf("bad location %q in config: %w", cfg.Location, err)
}

Prevention

When it happens

Trigger: A misspelled or nonexistent location name; an overly specific free-form string ('home'); a name that exists locally but not in Open-Meteo's database; area-qualified strings where the base name is wrong.

Common situations: Typos like 'Amsterdaam'; fictional or very small place names; users assuming a colloquial area name will resolve.

Related errors


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