{"record":{"id":"e460b66a013d6a03","repo":"MagicMirrorOrg/MagicMirror","slug":"unknown-weather-type-this-config-type-e460b6","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/openweathermap.js","lineNumber":123,"sourceCode":"\t\t\t\t\tthis.locationName = data.timezone;\n\t\t\t\t}\n\n\t\t\t\tconst onecallData = this.#generateWeatherObjectsFromOnecall(data);\n\n\t\t\t\tswitch (this.config.type) {\n\t\t\t\t\tcase \"current\":\n\t\t\t\t\t\tweatherData = onecallData.current;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"forecast\":\n\t\t\t\t\tcase \"daily\":\n\t\t\t\t\t\tweatherData = onecallData.days;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hourly\":\n\t\t\t\t\t\tweatherData = onecallData.hours;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tLog.error(`[openweathermap] Unknown type: ${this.config.type}`);\n\t\t\t\t\t\tthrow new Error(`Unknown weather type: ${this.config.type}`);\n\t\t\t\t}\n\t\t\t} else if (this.config.weatherEndpoint === \"/weather\") {\n\t\t\t\t// Current weather endpoint (API v2.5)\n\t\t\t\tweatherData = this.#generateWeatherObjectFromCurrentWeather(data);\n\t\t\t} else if (this.config.weatherEndpoint === \"/forecast\") {\n\t\t\t\t// 3-hourly forecast endpoint (API v2.5)\n\t\t\t\tweatherData = this.config.type === \"hourly\"\n\t\t\t\t\t? this.#generateHourlyWeatherObjectsFromForecast(data)\n\t\t\t\t\t: this.#generateDailyWeatherObjectsFromForecast(data);\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Unknown weather endpoint: ${this.config.weatherEndpoint}`);\n\t\t\t}\n\n\t\t\tif (weatherData && this.onDataCallback) {\n\t\t\t\tthis.onDataCallback(weatherData);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tLog.error(\"[openweathermap] Error processing weather data:\", error);","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/providers/openweathermap.js#L105-L141","documentation":"When using the One Call endpoint, openweathermap's #handleResponse switches on this.config.type to map the payload to current/daily/hourly weather objects. Unhandled types are logged and throw 'Unknown weather type'. This is a config validation error occurring after a successful API response.","triggerScenarios":"config.type contains a value outside the switch cases (e.g. 'minutely', 'alerts', typo) while weatherEndpoint is the One Call endpoint.","commonSituations":"Passing OpenWeather 'exclude' segments (minutely/alerts) as type by mistake; capitalization mismatch; config template not filled in.","solutions":["Set config.type to 'current', 'daily' or 'hourly'","Fix typos/casing in the type value","Add validation of type before initialize()"],"exampleFix":"// before\nconfig = { type: \"minutely\", ... }\n// after\nconfig = { type: \"current\", ... }","handlingStrategy":"validation","validationCode":"const OWM_TYPES = [\"current\", \"daily\", \"hourly\"];\nif (!OWM_TYPES.includes(config.type)) throw new Error(`openweathermap type must be one of ${OWM_TYPES.join(\" | \")}`);","typeGuard":"const isOwmType = (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(`Set config.type to current/daily/hourly (got '${config.type}')`);\n  } else throw err;\n}","preventionTips":["Map OpenWeb 'exclude' segments (minutely/alerts) separately — they are not types","Validate the type enum at config load time","Use consistent lowercase type strings across your app","Test each provider config in CI"],"tags":["config","openweathermap","unknown-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}