{"record":{"id":"a3201777fe12cf1d","repo":"MagicMirrorOrg/MagicMirror","slug":"unknown-weather-type-this-config-type","errorCode":null,"errorMessage":"Unknown weather type: ${this.config.type}","messagePattern":"Unknown weather type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"defaultmodules/weather/providers/buienradar.js","lineNumber":152,"sourceCode":"\t\t\t\tthrow new Error(\"Invalid API response\");\n\t\t\t}\n\n\t\t\tthis.#setLocationName(data.location);\n\n\t\t\tlet weatherData;\n\t\t\tswitch (this.config.type) {\n\t\t\t\tcase \"current\":\n\t\t\t\t\tweatherData = this.#generateCurrentWeather(data.days[0]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"forecast\":\n\t\t\t\tcase \"daily\":\n\t\t\t\t\tweatherData = this.#generateDailyForecast(data.days);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"hourly\":\n\t\t\t\t\tweatherData = this.#generateHourlyForecast(data.days);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unknown weather type: ${this.config.type}`);\n\t\t\t}\n\n\t\t\tif (this.onDataCallback && weatherData) {\n\t\t\t\tthis.onDataCallback(weatherData);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tLog.error(\"[buienradar] Error processing weather data:\", error);\n\t\t\tthis.#sendErrorCallback(error.message);\n\t\t}\n\t}\n\n\t#sendErrorCallback (message) {\n\t\tif (this.onErrorCallback) {\n\t\t\tthis.onErrorCallback({\n\t\t\t\tmessage,\n\t\t\t\ttranslationKey: ERROR_TRANSLATION_KEY\n\t\t\t});\n\t\t}","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/providers/buienradar.js#L134-L170","documentation":"After validating the buienradar response, #handleResponse switches on this.config.type to select daily or hourly generation. Any type other than 'current'/'daily'/'hourly' (whatever the supported cases are) falls to default and throws. It indicates an unsupported weather type string in the provider config.","triggerScenarios":"config.type set to a value not handled by the switch, e.g. 'weekly', 'minutely', or a typo like 'hourly ' or 'Hourly'.","commonSituations":"Copy-pasting config between providers with different supported types; case sensitivity mistakes; adding a type string the provider doesn't implement.","solutions":["Set config.type to a supported value: 'current', 'daily' or 'hourly'","Fix casing/typos in the type string (values are case-sensitive)","Check the provider's documented supported types"],"exampleFix":"// before\nconfig = { type: \"daily-forecast\", ... }\n// after\nconfig = { type: \"daily\", ... }","handlingStrategy":"validation","validationCode":"const SUPPORTED = [\"current\", \"daily\", \"hourly\"];\nif (!SUPPORTED.includes(config.type)) throw new Error(`Unsupported type ${config.type}; use one of ${SUPPORTED.join(\", \")}`);","typeGuard":"const isWeatherType = (t) => [\"current\", \"daily\", \"hourly\"].includes(t);","tryCatchPattern":"try {\n  provider.initialize(config);\n} catch (err) {\n  if (err.message.startsWith(\"Unknown weather type:\")) {\n    console.error(`Bad type '${config.type}' — allowed: current, daily, hourly`);\n  } else throw err;\n}","preventionTips":["Whitelist config.type against the provider's supported values at startup","Remember type strings are case-sensitive and trimmed exactly","Copy only types documented for THIS provider, not others","Add a schema check (e.g. zod enum) on the module config"],"tags":["config","buienradar","unknown-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}