MagicMirrorOrg/MagicMirror · error · Error
Failed to fetch grid point: HTTP ${pointsResponse.status}
Error message
Failed to fetch grid point: HTTP ${pointsResponse.status} What it means
The weathergov provider resolves lat/lon to a National Weather Service "grid point" via api.weather.gov/points during initialize. #fetchWeatherGovURLs throws this when that HTTP response is not ok, embedding the status code.
Source
Thrown at defaultmodules/weather/providers/weathergov.js:132
async #fetchWeatherGovURLs () {
// Step 1: Get grid point data
const pointsUrl = `${this.config.apiBase}${this.config.lat},${this.config.lon}`;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 120000); // 120 second timeout - DNS can be slow
try {
const pointsResponse = await fetch(pointsUrl, {
signal: controller.signal,
headers: {
"User-Agent": "MagicMirror",
Accept: "application/geo+json"
}
});
if (!pointsResponse.ok) {
throw new Error(`Failed to fetch grid point: HTTP ${pointsResponse.status}`);
}
const pointsData = await pointsResponse.json();
if (!pointsData || !pointsData.properties) {
throw new Error("Invalid grid point data");
}
// Extract location name
const relLoc = pointsData.properties.relativeLocation?.properties;
if (relLoc) {
this.locationName = `${relLoc.city}, ${relLoc.state}`;
}
// Store forecast URLs
this.forecastURL = `${pointsData.properties.forecast}?units=si`;
this.forecastHourlyURL = `${pointsData.properties.forecastHourly}?units=si`;
this.forecastGridDataURL = pointsData.properties.forecastGridData;View on GitHub (pinned to 4b4a59534f)
Solutions
- Check the status code in the message: 404 means coordinates are outside NWS coverage — use US lat/lon or a different provider.
- Verify api.weather.gov is up (status.weather.gov) for 5xx codes; retry later.
- Confirm lat/lon are correct, decimal numbers, and not swapped (lat in [-90,90], lon in [-180,180]).
- Ensure your network/firewall allows requests to api.weather.gov with a User-Agent header.
Example fix
// before
config: { weatherProvider: "weathergov", lat: 48.85, lon: 2.35 } // Paris — not covered
// after
config: { weatherProvider: "weathergov", lat: 38.89, lon: -77.03 } // Washington DC
// or switch provider:
config: { weatherProvider: "openmeteo", lat: 48.85, lon: 2.35 } Defensive patterns
Strategy: validation
Validate before calling
// weathergov covers only the USA and territories
const inUS = (lat, lon) => lat >= 24.5 && lat <= 49.5 && lon >= -125 && lon <= -66.5; // rough CONUS box
if (!inUS(config.lat, config.lon)) {
console.warn("weathergov: coordinates likely outside NWS coverage — choose another provider");
} Try / catch
try {
await provider.initialize();
} catch (err) {
const m = err.message.match(/HTTP (\d+)/);
if (m && (m[1] === "404" || m[1] === "400")) {
Log.error("weathergov: bad coords or non-US location");
} else if (m && m[1].startsWith("5")) {
Log.warn("NWS API down — retrying in 5 min");
setTimeout(() => provider.initialize(), 5 * 60_000);
} else { throw err; }
} Prevention
- Use US decimal-degree coordinates with weathergov; swap lat/lon only deliberately.
- Add a retry with backoff for 5xx before surfacing the error.
- Check status.weather.gov during NWS incidents before debugging your own code.
When it happens
Trigger: GET to the points endpoint returns 404 (coordinates outside the USA), 400 (malformed lat/lon), 500/503 (NWS API outage), or is blocked, producing any non-ok status.
Common situations: Non-US coordinates (weather.gov only covers the US and territories); NWS API downtime/rate limiting; network egress blocked in the deployment environment; typo'd coordinates like lat/lon swapped.
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
- Invalid API response
- Invalid grid point data
- Failed to fetch observation stations: HTTP ${stationsRespons
- HTTP ${response.status}
- No observation stations found
AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31).
Data as JSON: /api/errors/d1bab1b85a1201e1.
Report an issue: GitHub.