jackwener/OpenCLI · warning · EmptyResultError

wttr.in returned no current conditions for "${location}".

Error message

wttr.in returned no current conditions for "${location}".

What it means

EmptyResultError thrown by `opencli wttr current` when the wttr.in JSON response has no current_condition array or it is empty. The command requires at least one current-conditions object to build its output row, so it treats the absence as an empty result naming the requested location.

Source

Thrown at clis/wttr/current.js:37

            name: 'location',
            positional: true,
            required: true,
            help: 'City name, "lat,lon", airport ICAO code, or "@domain"',
        },
    ],
    columns: [
        'location', 'region', 'country', 'latitude', 'longitude',
        'observedAt', 'tempC', 'tempF', 'feelsLikeC', 'feelsLikeF',
        'description', 'humidity', 'cloudCover', 'pressure',
        'precipMm', 'visibilityKm', 'uvIndex',
        'windKmph', 'windDirection', 'windDirectionDegree',
    ],
    func: async (args) => {
        const location = requireString(args.location, 'location');
        const body = await wttrFetch(location, 'wttr current');
        const cur = Array.isArray(body?.current_condition) ? body.current_condition[0] : null;
        if (!cur) {
            throw new EmptyResultError('wttr current', `wttr.in returned no current conditions for "${location}".`);
        }
        const area = Array.isArray(body?.nearest_area) ? body.nearest_area[0] : null;
        return [{
            location: pickWeatherDesc(area?.areaName) || location,
            region: pickWeatherDesc(area?.region),
            country: pickWeatherDesc(area?.country),
            latitude: area?.latitude ?? null,
            longitude: area?.longitude ?? null,
            observedAt: cur.localObsDateTime ?? null,
            tempC: cur.temp_C != null ? Number(cur.temp_C) : null,
            tempF: cur.temp_F != null ? Number(cur.temp_F) : null,
            feelsLikeC: cur.FeelsLikeC != null ? Number(cur.FeelsLikeC) : null,
            feelsLikeF: cur.FeelsLikeF != null ? Number(cur.FeelsLikeF) : null,
            description: pickWeatherDesc(cur.weatherDesc),
            humidity: cur.humidity != null ? Number(cur.humidity) : null,
            cloudCover: cur.cloudcover != null ? Number(cur.cloudcover) : null,
            pressure: cur.pressure != null ? Number(cur.pressure) : null,
            precipMm: cur.precipMM != null ? Number(cur.precipMM) : null,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry — wttr.in rate limits are per-minute and often transient
  2. Use a more standard location format: "City" or "City,Country" (e.g. "Paris,France") or an airport code
  3. Use fewer calls or cache results to stay under wttr.in's rate limit
  4. Fall back to a nearby larger city the service definitely resolves

Example fix

// before
opencli wttr current "some tiny village"
// after
opencli wttr current "Paris,France"
Defensive patterns

Strategy: fallback

Validate before calling

if (!location || !location.trim()) throw new Error('location is required');

Type guard

function hasCurrentCondition(body) {
  return Array.isArray(body?.current_condition) && body.current_condition.length > 0 && !!body.current_condition[0];
}

Try / catch

try {
  const rows = await run('wttr current', [location]);
} catch (e) {
  if (/no current conditions/.test(e.message)) {
    return run('wttr current', ['London']);
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli wttr current <location>` where wttrFetch's parsed body lacks body.current_condition[0] — wttr.in returning an error page/empty body for an unresolvable location, rate limiting (wttr.in heavily limits anonymous requests), or upstream service degradation.

Common situations: Unrecognized or ambiguous location strings, wttr.in rate limits (very common with shared/VPN IPs), wttr.in outages, typos in the location name.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/a718ef972dc6f8cd. Report an issue: GitHub.