MagicMirrorOrg/MagicMirror · error · Error
No observation stations found
Error message
No observation stations found
What it means
After a successful stations fetch, the provider requires a non-empty stationsData.features array, since it uses features[0].id to build the latest-observations URL. An empty or malformed feature collection means no observation station is available for this location, so initialization throws.
Source
Thrown at defaultmodules/weather/providers/weathergov.js:169
this.observationStationsURL = pointsData.properties.observationStations;
// Step 2: Get observation station URL
const stationsResponse = await fetch(this.observationStationsURL, {
signal: controller.signal,
headers: {
"User-Agent": "MagicMirror",
Accept: "application/geo+json"
}
});
if (!stationsResponse.ok) {
throw new Error(`Failed to fetch observation stations: HTTP ${stationsResponse.status}`);
}
const stationsData = await stationsResponse.json();
if (!stationsData || !stationsData.features || stationsData.features.length === 0) {
throw new Error("No observation stations found");
}
this.stationObsURL = `${stationsData.features[0].id}/observations/latest`;
Log.log(`[weathergov] Initialized for ${this.locationName}`);
} finally {
clearTimeout(timeoutId);
}
}
#initializeFetcher () {
let url;
switch (this.config.type) {
case "current":
url = this.stationObsURL;
break;
case "forecast":View on GitHub (pinned to 4b4a59534f)
Solutions
- Switch the module type to "forecast" or "daily" — those do not require an observation station.
- Pick a different provider (e.g. openmeteo, smhi) that serves your region's current conditions.
- Adjust coordinates slightly toward a populated area with METAR stations.
- Log stationsData to confirm whether the API returned an empty feature collection or an error body.
Example fix
// before
config: { weatherProvider: "weathergov", type: "current", lat: 21.3, lon: -157.9 }
// after (no station coverage)
config: { weatherProvider: "weathergov", type: "forecast", lat: 21.3, lon: -157.9 } Defensive patterns
Strategy: fallback
Validate before calling
const r = await fetch(`${gridpoint}/stations`, { headers: { "User-Agent": "MagicMirror" } });
const j = await r.json();
if (!Array.isArray(j?.features) || j.features.length === 0) {
console.warn("No NWS stations here — configure type 'forecast' or another provider");
} Type guard
function hasStations(d) {
return !!d && Array.isArray(d.features) && d.features.length > 0;
} Try / catch
try {
await provider.initialize();
} catch (err) {
if (err.message === "No observation stations found") {
Log.warn("weathergov: no stations; switching to forecast mode");
provider.config.type = "forecast";
await provider.initialize();
} else { throw err; }
} Prevention
- Prefer type "forecast"/"daily" in areas with sparse station coverage.
- Pick another provider (openmeteo, smhi) for regions weathergov does not observe.
- Treat empty feature collections as a config-time concern: check coverage before deploying.
When it happens
Trigger: The stations endpoint returns 200 with features: [] (no station within the grid point's coverage), or a body without a features array (error envelope that passed the ok check).
Common situations: Remote locations, islands, or newly added grid points with sparse station coverage; NWS returning an error body with a 200 status via intermediary caches.
Related errors
- Invalid current weather data
- Invalid API response
- Failed to fetch grid point: HTTP ${pointsResponse.status}
- Invalid grid point data
- Unknown weather type: ${this.config.type}
AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31).
Data as JSON: /api/errors/71401799df173785.
Report an issue: GitHub.