{"record":{"id":"2f82a57c2c5ba623","repo":"MagicMirrorOrg/MagicMirror","slug":"unknown-weather-type-this-config-type-2f82a5","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/weatherapi.js","lineNumber":58,"sourceCode":"\t\t\tthis.fetcher.startPeriodicFetch();\n\t\t}\n\t}\n\n\tstop () {\n\t\tif (this.fetcher) {\n\t\t\tthis.fetcher.clearTimer();\n\t\t}\n\t}\n\n\t#validateConfig () {\n\t\tthis.config.type = `${this.config.type ?? \"\"}`.trim().toLowerCase();\n\n\t\tif (this.config.type === \"forecast\") {\n\t\t\tthis.config.type = \"daily\";\n\t\t}\n\n\t\tif (![\"hourly\", \"daily\", \"current\"].includes(this.config.type)) {\n\t\t\tthrow new Error(`Unknown weather type: ${this.config.type}`);\n\t\t}\n\n\t\tif (!this.config.apiKey || `${this.config.apiKey}`.trim() === \"\") {\n\t\t\tthrow new Error(\"apiKey is required\");\n\t\t}\n\n\t\tif (!Number.isFinite(this.config.lat) || !Number.isFinite(this.config.lon)) {\n\t\t\tthrow new Error(\"Latitude and longitude are required\");\n\t\t}\n\t}\n\n\t#initializeFetcher () {\n\t\tconst url = this.#getUrl();\n\n\t\tthis.fetcher = new HTTPFetcher(url, {\n\t\t\treloadInterval: this.config.updateInterval,\n\t\t\theaders: { \"Cache-Control\": \"no-cache\" },\n\t\t\tlogContext: \"weatherprovider.weatherapi\"","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/defaultmodules/weather/providers/weatherapi.js#L40-L76","documentation":"The WeatherAPI.com provider validates its configured weather type at startup in #validateConfig. Only \"hourly\", \"daily\" and \"current\" are supported; a config of \"forecast\" is auto-rewritten to \"daily\" before the check. Any other value (typo, wrong provider keyword, missing type) throws this Error during initialize.","triggerScenarios":"config.type is set to anything other than \"hourly\", \"daily\", \"current\" (or \"forecast\", which is normalized to \"daily\") when the module initializes — e.g. type: \"Forecast\", type: \"weekly\", or type omitted so it is undefined.","commonSituations":"Copy-pasting a config from another weather provider (weathergov uses \"forecast\"; openmeteo/other modules use different vocab), typos or wrong capitalization, forgetting the type field entirely so undefined fails the includes() check.","solutions":["Set weatherProvider: \"weatherapi\" config type to one of \"current\", \"hourly\", \"daily\" (or \"forecast\", which is accepted and treated as daily).","Check for typos/case: values are compared exactly, lowercase.","If migrating from another provider, map its type vocabulary to weatherapi's hourly/daily/current.","Ensure the type property is actually defined in the module config and not overridden by another module."],"exampleFix":"// before\nconfig: {\n  weatherProvider: \"weatherapi\",\n  type: \"forecast5day\"\n}\n// after\nconfig: {\n  weatherProvider: \"weatherapi\",\n  type: \"daily\"\n}","handlingStrategy":"validation","validationCode":"const ALLOWED = [\"current\", \"hourly\", \"daily\", \"forecast\"];\nif (!ALLOWED.includes(config.type)) {\n  throw new Error(`weatherapi: type must be one of ${ALLOWED.join(\", \")}, got ${JSON.stringify(config.type)}`);\n}","typeGuard":"function isValidWeatherType(t) {\n  return typeof t === \"string\" && [\"hourly\", \"daily\", \"current\"].includes(t);\n}","tryCatchPattern":null,"preventionTips":["Copy type values only from the provider's documented list (current/hourly/daily/forecast).","Keep a shared constants file for type strings across providers.","Validate the whole weather config at startup with a schema check before module init."],"tags":["config","validation","weather","magicmirror"],"backgroundTag":"invalid-config-value","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}