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

  1. Set weatherEndpoint to one of '/onecall', '/weather' or '/forecast'
  2. If you intended One Call 3.0, confirm the module version supports that endpoint string
  3. 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

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


AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31). Data as JSON: /api/errors/9cd72f94bf418aaa. Report an issue: GitHub.