MagicMirrorOrg/MagicMirror · error · Error
Unknown weather endpoint: ${this.config.weatherEndpoint}
Error message
Unknown weather endpoint: ${this.config.weatherEndpoint} What it means
#handleResponse dispatches on this.config.weatherEndpoint: only '/onecall', '/weather' and '/forecast' are supported; anything else throws 'Unknown weather endpoint'. It catches stale or invalid endpoint configuration before the data is used.
Source
Thrown at defaultmodules/weather/providers/openweathermap.js:134
weatherData = onecallData.days;
break;
case "hourly":
weatherData = onecallData.hours;
break;
default:
Log.error(`[openweathermap] Unknown type: ${this.config.type}`);
throw new Error(`Unknown weather type: ${this.config.type}`);
}
} else if (this.config.weatherEndpoint === "/weather") {
// Current weather endpoint (API v2.5)
weatherData = this.#generateWeatherObjectFromCurrentWeather(data);
} else if (this.config.weatherEndpoint === "/forecast") {
// 3-hourly forecast endpoint (API v2.5)
weatherData = this.config.type === "hourly"
? this.#generateHourlyWeatherObjectsFromForecast(data)
: this.#generateDailyWeatherObjectsFromForecast(data);
} else {
throw new Error(`Unknown weather endpoint: ${this.config.weatherEndpoint}`);
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[openweathermap] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#generateWeatherObjectFromCurrentWeather (data) {
const timezoneOffsetMinutes = (data.timezone ?? 0) / 60;View on GitHub (pinned to 4b4a59534f)
Solutions
- Set weatherEndpoint to one of '/onecall', '/weather' or '/forecast'
- If you intended One Call 3.0, confirm the module version supports that endpoint string
- Remove any absolute URLs from weatherEndpoint — it expects a path only
Example fix
// before
config = { weatherEndpoint: "/forecast16", ... }
// after
config = { weatherEndpoint: "/forecast", ... } Defensive patterns
Strategy: validation
Validate before calling
const OWM_ENDPOINTS = ["/onecall", "/weather", "/forecast"];
if (!OWM_ENDPOINTS.includes(config.weatherEndpoint)) throw new Error(`weatherEndpoint must be one of ${OWM_ENDPOINTS.join(" | ")}`); Type guard
const isOwmEndpoint = (e) => ["/onecall", "/weather", "/forecast"].includes(e);
Try / catch
try {
provider.initialize(config);
} catch (err) {
if (err.message.startsWith("Unknown weather endpoint:")) {
console.error(`'${config.weatherEndpoint}' unsupported — use /onecall, /weather or /forecast`);
} else throw err;
} Prevention
- Use only path values (/weather, /forecast, /onecall), never full URLs
- Check migration notes when upgrading — endpoint names change across versions
- Validate weatherEndpoint in a config schema before init
- Align type+endpoint combos that the provider actually supports
When it happens
Trigger: config.weatherEndpoint set to '/one', '', '/forecast/hourly', a full URL, or a removed/renamed endpoint (e.g. old '/daily').
Common situations: Upgrading from an older module version where endpoint names differed; typos in the endpoint string; accidentally pasting an absolute URL into the endpoint config.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown weather type: ${this.config.type}
- Unknown weather type: ${this.config.type}
- Unknown weather type: ${this.config.type}
- setCallbacks() must be called before initialize()
- Latitude and longitude are required
AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31).
Data as JSON: /api/errors/9cd72f94bf418aaa.
Report an issue: GitHub.