moeru-ai/airi · error · Error
Geocoding request failed: ${res.status}
Error message
Geocoding request failed: ${res.status} What it means
Thrown by geocodeCity when the Open-Meteo geocoding API responds with a non-ok HTTP status (res.ok is false). The URL is built from the user-supplied city via encodeURIComponent. The status code is embedded in the message for diagnostics.
Source
Thrown at apps/stage-tamagotchi/src/renderer/stores/tools/builtin/weather-api.ts:100
const nightVariants: Record<string, string> = {
'clear-day': 'clear-night',
'partly-cloudy-day': 'partly-cloudy-night',
}
return {
...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',View on GitHub (pinned to 27111382b4)
Solutions
- Retry after a short delay — 5xx and 429 are typically transient.
- Sanitize/trim the city input before encoding.
- Check Open-Meteo status page for incidents.
- If behind a proxy, verify it permits geocoding-api.open-meteo.com.
Defensive patterns
Strategy: retry
Validate before calling
function isLikelyValidCity(city: string): boolean {
return typeof city === 'string' && city.trim().length > 0 && city.trim().length <= 100
} Try / catch
async function geocodeWithRetry(city: string, attempts = 2) {
for (let i = 0; i < attempts; i++) {
try { return await geocodeCity(city) }
catch (e) {
if (i === attempts - 1) throw e
await new Promise(r => setTimeout(r, 800))
}
}
throw new Error('unreachable')
} Prevention
- Trim and sanity-check the city string before encoding.
- Retry on 429/5xx with backoff.
- Cache successful geocode results to reduce API load.
When it happens
Trigger: Open-Meteo geocoding endpoint returned 4xx/5xx — malformed city parameter after encoding, rate limited (429), service down (5xx), or network proxy returned an error status.
Common situations: Transient Open-Meteo outage; aggressive polling hit rate limits; very long/special-character city string; corporate proxy returning 403/502.
Related errors
- Weather request failed: ${res.status}
- No output received from Replicate.
- Failed to fetch GitHub releases atom (${atomResponse.status}
- City not found: "${city}"
- No candidate server channel URL was reachable. ${errors.join
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/41e960f935105415.
Report an issue: GitHub.