moeru-ai/airi · error · Error
City not found: "${city}"
Error message
City not found: "${city}" What it means
Thrown by geocodeCity when the geocoding request succeeded (res.ok) but data.results is empty or undefined — the API found no match for the city. This is a logical 'not found', not a transport error.
Source
Thrown at apps/stage-tamagotchi/src/renderer/stores/tools/builtin/weather-api.ts:105
...mapped,
conditionCode: nightVariants[mapped.conditionCode] ?? mapped.conditionCode,
}
}
return mapped
}
export async function geocodeCity(city: string): Promise<{ name: string, latitude: number, longitude: number, country: string }> {
const url = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1&language=en&format=json`
const res = await fetch(url)
if (!res.ok)
throw new Error(`Geocoding request failed: ${res.status}`)
const data: GeocodingResult = await res.json()
if (!data.results?.length)
throw new Error(`City not found: "${city}"`)
const result = data.results[0]
return { name: result.name, latitude: result.latitude, longitude: result.longitude, country: result.country }
}
export async function fetchWeather(city: string): Promise<WeatherData> {
const geo = await geocodeCity(city)
const params = new URLSearchParams({
latitude: String(geo.latitude),
longitude: String(geo.longitude),
current: 'temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,precipitation,is_day',
daily: 'temperature_2m_max,temperature_2m_min',
forecast_days: '1',
})
const res = await fetch(`https://api.open-meteo.com/v1/forecast?${params}`)
View on GitHub (pinned to 27111382b4)
Solutions
- Correct the city spelling or use the official English name.
- Try a broader region name (e.g. the province or nearby major city).
- Increase the geocoding count parameter and disambiguate, or accept country codes.
- Surface 'City not found' to the user and re-prompt.
Defensive patterns
Strategy: validation
Validate before calling
function isResolvableCity(city: string): boolean {
// cheap client-side check before calling the geocoder
return /^[\p{L} .'-]+$/u.test(city.trim()) && city.trim().length >= 2
} Try / catch
try {
await geocodeCity(city)
} catch (e) {
if (e instanceof Error && e.message.startsWith('City not found')) {
// prompt user to re-enter / disambiguate the city
} else throw e
} Prevention
- Autocomplete city names from a known list when possible.
- Strip diacritics/whitespace and try alternate spellings on not-found.
- Surface 'City not found' as a recoverable prompt, not a crash.
When it happens
Trigger: User asked for weather in a city name Open-Meteo cannot resolve — typo, non-existent place, ambiguous name with count=1 returning nothing, or a city in a script/language the geocoder doesn't index.
Common situations: Typo in city name; very small/obscure locality not in the geocoder; user used a local-language name not indexed; city merged/renamed.
Related errors
- Geocoding request failed: ${res.status}
- Invalid Godot stage scene input payload.
- Workflow error: ${errorBody.slice(0, 200)}
- ComfyUI returned no prompt_id
- No image data returned from Nano Banana
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/3011fb871e957eef.
Report an issue: GitHub.