{"record":{"id":"d1bab1b85a1201e1","repo":"MagicMirrorOrg/MagicMirror","slug":"failed-to-fetch-grid-point-http-pointsresponse","errorCode":null,"errorMessage":"Failed to fetch grid point: HTTP ${pointsResponse.status}","messagePattern":"Failed to fetch grid point: HTTP (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"defaultmodules/weather/providers/weathergov.js","lineNumber":132,"sourceCode":"\n\tasync #fetchWeatherGovURLs () {\n\t\t// Step 1: Get grid point data\n\t\tconst pointsUrl = `${this.config.apiBase}${this.config.lat},${this.config.lon}`;\n\n\t\tconst controller = new AbortController();\n\t\tconst timeoutId = setTimeout(() => controller.abort(), 120000); // 120 second timeout - DNS can be slow\n\n\t\ttry {\n\t\t\tconst pointsResponse = await fetch(pointsUrl, {\n\t\t\t\tsignal: controller.signal,\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": \"MagicMirror\",\n\t\t\t\t\tAccept: \"application/geo+json\"\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (!pointsResponse.ok) {\n\t\t\t\tthrow new Error(`Failed to fetch grid point: HTTP ${pointsResponse.status}`);\n\t\t\t}\n\n\t\t\tconst pointsData = await pointsResponse.json();\n\n\t\t\tif (!pointsData || !pointsData.properties) {\n\t\t\t\tthrow new Error(\"Invalid grid point data\");\n\t\t\t}\n\n\t\t\t// Extract location name\n\t\t\tconst relLoc = pointsData.properties.relativeLocation?.properties;\n\t\t\tif (relLoc) {\n\t\t\t\tthis.locationName = `${relLoc.city}, ${relLoc.state}`;\n\t\t\t}\n\n\t\t\t// Store forecast URLs\n\t\t\tthis.forecastURL = `${pointsData.properties.forecast}?units=si`;\n\t\t\tthis.forecastHourlyURL = `${pointsData.properties.forecastHourly}?units=si`;\n\t\t\tthis.forecastGridDataURL = pointsData.properties.forecastGridData;","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/providers/weathergov.js#L114-L150","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconfig: { weatherProvider: \"weathergov\", lat: 48.85, lon: 2.35 } // Paris — not covered\n// after\nconfig: { weatherProvider: \"weathergov\", lat: 38.89, lon: -77.03 } // Washington DC\n// or switch provider:\nconfig: { weatherProvider: \"openmeteo\", lat: 48.85, lon: 2.35 }","handlingStrategy":"validation","validationCode":"// weathergov covers only the USA and territories\nconst inUS = (lat, lon) => lat >= 24.5 && lat <= 49.5 && lon >= -125 && lon <= -66.5; // rough CONUS box\nif (!inUS(config.lat, config.lon)) {\n  console.warn(\"weathergov: coordinates likely outside NWS coverage — choose another provider\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await provider.initialize();\n} catch (err) {\n  const m = err.message.match(/HTTP (\\d+)/);\n  if (m && (m[1] === \"404\" || m[1] === \"400\")) {\n    Log.error(\"weathergov: bad coords or non-US location\");\n  } else if (m && m[1].startsWith(\"5\")) {\n    Log.warn(\"NWS API down — retrying in 5 min\");\n    setTimeout(() => provider.initialize(), 5 * 60_000);\n  } else { throw err; }\n}","preventionTips":["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."],"tags":["network","http","weather","api"],"backgroundTag":"http-request-failed","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}