{"record":{"id":"71401799df173785","repo":"MagicMirrorOrg/MagicMirror","slug":"no-observation-stations-found","errorCode":null,"errorMessage":"No observation stations found","messagePattern":"No observation stations found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"defaultmodules/weather/providers/weathergov.js","lineNumber":169,"sourceCode":"\t\t\tthis.observationStationsURL = pointsData.properties.observationStations;\n\n\t\t\t// Step 2: Get observation station URL\n\t\t\tconst stationsResponse = await fetch(this.observationStationsURL, {\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 (!stationsResponse.ok) {\n\t\t\t\tthrow new Error(`Failed to fetch observation stations: HTTP ${stationsResponse.status}`);\n\t\t\t}\n\n\t\t\tconst stationsData = await stationsResponse.json();\n\n\t\t\tif (!stationsData || !stationsData.features || stationsData.features.length === 0) {\n\t\t\t\tthrow new Error(\"No observation stations found\");\n\t\t\t}\n\n\t\t\tthis.stationObsURL = `${stationsData.features[0].id}/observations/latest`;\n\n\t\t\tLog.log(`[weathergov] Initialized for ${this.locationName}`);\n\t\t} finally {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t}\n\n\t#initializeFetcher () {\n\t\tlet url;\n\n\t\tswitch (this.config.type) {\n\t\t\tcase \"current\":\n\t\t\t\turl = this.stationObsURL;\n\t\t\t\tbreak;\n\t\t\tcase \"forecast\":","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/providers/weathergov.js#L151-L187","documentation":"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.","triggerScenarios":"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).","commonSituations":"Remote locations, islands, or newly added grid points with sparse station coverage; NWS returning an error body with a 200 status via intermediary caches.","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."],"exampleFix":"// before\nconfig: { weatherProvider: \"weathergov\", type: \"current\", lat: 21.3, lon: -157.9 }\n// after (no station coverage)\nconfig: { weatherProvider: \"weathergov\", type: \"forecast\", lat: 21.3, lon: -157.9 }","handlingStrategy":"fallback","validationCode":"const r = await fetch(`${gridpoint}/stations`, { headers: { \"User-Agent\": \"MagicMirror\" } });\nconst j = await r.json();\nif (!Array.isArray(j?.features) || j.features.length === 0) {\n  console.warn(\"No NWS stations here — configure type 'forecast' or another provider\");\n}","typeGuard":"function hasStations(d) {\n  return !!d && Array.isArray(d.features) && d.features.length > 0;\n}","tryCatchPattern":"try {\n  await provider.initialize();\n} catch (err) {\n  if (err.message === \"No observation stations found\") {\n    Log.warn(\"weathergov: no stations; switching to forecast mode\");\n    provider.config.type = \"forecast\";\n    await provider.initialize();\n  } else { throw err; }\n}","preventionTips":["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."],"tags":["api","weather","empty-data","coverage"],"backgroundTag":"empty-api-response","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}