{"record":{"id":"5b114138224c79e5","repo":"MagicMirrorOrg/MagicMirror","slug":"unknown-weather-data-type-type","errorCode":null,"errorMessage":"Unknown weather data type: ${type}","messagePattern":"Unknown weather data type: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"defaultmodules/weather/weather.js","lineNumber":208,"sourceCode":"\n\t\tif (!data) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert plain objects to WeatherObject instances\n\t\tswitch (type) {\n\t\t\tcase \"current\":\n\t\t\t\tthis.currentWeatherObject = this.createWeatherObject(data);\n\t\t\t\tbreak;\n\t\t\tcase \"forecast\":\n\t\t\tcase \"daily\":\n\t\t\t\tthis.weatherForecastArray = data.map((d) => this.createWeatherObject(d));\n\t\t\t\tbreak;\n\t\t\tcase \"hourly\":\n\t\t\t\tthis.weatherHourlyArray = data.map((d) => this.createWeatherObject(d));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tLog.warn(`Unknown weather data type: ${type}`);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.updateAvailable();\n\t},\n\n\tcreateWeatherObject (data) {\n\t\tconst weather = new WeatherObject();\n\t\tObject.assign(weather, {\n\t\t\t...data,\n\t\t\t// Convert to moment objects for template compatibility\n\t\t\tdate: data.date ? moment(data.date) : null,\n\t\t\tsunrise: data.sunrise ? moment(data.sunrise) : null,\n\t\t\tsunset: data.sunset ? moment(data.sunset) : null\n\t\t});\n\t\treturn weather;\n\t},\n","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/weather.js#L190-L226","documentation":"handleWeatherData dispatches incoming provider payloads by a `type` key ('current', 'forecast', 'hourly', ...). If the type matches no case, the default branch warns 'Unknown weather data type' and skips storing the data, though updateAvailable() still runs. It signals a provider/notification contract mismatch rather than a fatal fault.","triggerScenarios":"A weather provider (custom or third-party) sends a socket notification whose data type string is not one of the handled cases — e.g. typos like 'fetched' vs expected values, or a provider emitting an extra type like 'daily' not implemented in this module version.","commonSituations":"Using a community weather provider built against a different module version; editing provider code and misspelling the type; module/provider version skew after an upgrade.","solutions":["Check the provider's fetchedData/notification code and ensure it emits a type matching 'current'/'forecast'/'hourly' as expected by this module version.","Update both the weather module and the provider to matching versions.","If writing a custom provider, add the new type case to handleWeatherData or map it to an existing one."],"exampleFix":"// before (provider)\nthis.sendSocketNotification(\"WEATHER_DATA\", { type: \"daily\", data });\n// after\nthis.sendSocketNotification(\"WEATHER_DATA\", { type: \"forecast\", data });","handlingStrategy":"type-guard","validationCode":"const VALID_TYPES = [\"current\", \"forecast\", \"hourly\"];\nif (!VALID_TYPES.includes(payload.type)) {\n  console.warn(`Provider sent unknown type: ${payload.type}`);\n}","typeGuard":"function isKnownWeatherType(t) {\n  return t === \"current\" || t === \"forecast\" || t === \"hourly\";\n}","tryCatchPattern":"// consumer side\ntry {\n  handleWeatherData(payload);\n} catch (e) {\n  Log.error(`weather data dispatch failed: ${e.message}`);\n}","preventionTips":["Keep provider notification types in sync with the module version you run.","Centralize valid type names as shared constants between provider and module.","Test custom providers against the stock weather module before deploying."],"tags":["weather","data-type","provider-mismatch"],"backgroundTag":"unknown-enum-value","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}