MagicMirrorOrg/MagicMirror · error · Error
Failed to fetch observation stations: HTTP ${stationsRespons
Error message
Failed to fetch observation stations: HTTP ${stationsResponse.status} What it means
To find the nearest observation station, #fetchWeatherGovURLs fetches the stations collection for the grid point. A non-ok HTTP status (embedded in the message) aborts initialization with this Error.
Source
Thrown at defaultmodules/weather/providers/weathergov.js:163
}
// Store forecast URLs
this.forecastURL = `${pointsData.properties.forecast}?units=si`;
this.forecastHourlyURL = `${pointsData.properties.forecastHourly}?units=si`;
this.forecastGridDataURL = pointsData.properties.forecastGridData;
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;View on GitHub (pinned to 4b4a59534f)
Solutions
- Check the status: 429/503 means rate limited or down — increase the updateInterval and retry later.
- Verify api.weather.gov health at status.weather.gov for 5xx errors.
- Reduce polling frequency so you stay under NWS rate limits (user-agent identified clients are expected to poll sparingly).
- If only current-weather observation fails, consider type "forecast"/"daily" which does not need stations.
Example fix
// before
config: { weatherProvider: "weathergov", type: "current", updateInterval: 60000 } // too aggressive
// after
config: { weatherProvider: "weathergov", type: "current", updateInterval: 600000 } Defensive patterns
Strategy: retry
Validate before calling
// verify the stations endpoint before enabling type "current"
const r = await fetch(`${forecastGridpoint}/stations`, { headers: { "User-Agent": "MagicMirror" } });
if (!r.ok) throw new Error(`stations pre-flight failed: HTTP ${r.status}`); Try / catch
async function initWithRetry(provider, tries = 3) {
for (let i = 0; i < tries; i++) {
try { await provider.initialize(); return; }
catch (err) {
const m = err.message.match(/HTTP (\d+)/);
const retryable = m && (m[1].startsWith("5") || m[1] === "429");
if (!retryable || i === tries - 1) throw err;
await new Promise(r => setTimeout(r, 2 ** i * 30_000));
}
}
} Prevention
- Set updateInterval >= 10 minutes; NWS asks clients not to poll aggressively.
- Back off exponentially on 429/5xx instead of failing hard.
- Use type "forecast" when station availability is not essential.
When it happens
Trigger: GET to the grid point's stations endpoint returns 404 (grid point has no station list), 429/503 (rate limit or NWS outage), or any other non-ok status.
Common situations: NWS API rate limiting after frequent polling (MagicMirror's default interval); api.weather.gov incidents; requesting stations for remote/ocean grid points with sparse coverage.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to fetch grid point: HTTP ${pointsResponse.status}
- HTTP ${response.status}
- Invalid API response
- 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/0a2b689a00797673.
Report an issue: GitHub.