Every failure is a LocationPickerError with a stable code, a one-line fix and a level. Its message reads
[location-picker] <what happened>. Fix: <fix>.
- Failures that are not tied to a returned promise fire a cancelable
errorevent (it does not bubble) on the element or the class instance. When no listener callspreventDefault()and noonErrorcallback exists, it is logged at itslevel. - Methods (
locate(),geocode(),lookupAddress()) and thereadypromise reject with the same error instead. {placeholders}in a message are filled in with the details of the failure.
The level below is the default for each code; a few cases override it (see
LocationPickerErrorCode).
| Code | Level | Fix |
|---|---|---|
TARGET_NOT_FOUND |
error |
Pass an element, an id ("map") or a selector ("#map") that exists when the picker is created. |
INVALID_VALUE |
warn |
Pass "lat,lng" (latitude first), e.g. "48.8584,2.2945", or {lat, lng}. |
INVALID_OPTION |
error |
Check the option name and value against the LocationPickerOptions docs. |
ENGINE_MISSING |
error |
Load Leaflet first, pass engine: L, or remove engine-url="none". |
ENGINE_LOAD_FAILED |
error |
Check the network and the CSP script-src, or self-host the engine and set engine-url. |
ENGINE_CSS_MISSING |
warn |
Load leaflet.css on the page, set engine-css-url, or allow https://cdn.jsdelivr.net. |
API_KEY_MISSING |
error |
Add api-key="YOUR_KEY", or load the Google Maps JS API before the picker. |
GOOGLE_AUTH_FAILED |
error |
Check the key's HTTP-referrer restrictions, billing, and that Maps JavaScript API is enabled. |
MAP_ID_REQUIRED |
warn |
Set map-id (mapId), or use marker="pin". |
GEOCODER_MISMATCH |
error |
Use the provider's paired geocoder; Google's terms forbid mixing Google and non-Google content. |
GEOCODER_MISSING |
error |
Remove geocoder: false, or pass a geocoder. |
GEOCODER_FAILED |
warn |
Check the network and the service's rate limits; use your own geocoder in production. |
GEOLOCATION_UNSUPPORTED |
warn |
Serve the page over HTTPS, and add allow="geolocation" to a containing iframe. |
GEOLOCATION_DENIED |
warn |
Allow location access in the browser's site settings, or pick the point on the map. |
GEOLOCATION_UNAVAILABLE |
warn |
Try again (Wi-Fi helps), or pick the point on the map. |
GEOLOCATION_TIMEOUT |
warn |
Try again, or raise geolocation.timeout. |
ABORTED |
silent |
Nothing to fix: the picker was destroyed or a newer request replaced this one. |
- Level:
error(logged withconsole.errorwhen unhandled) - Message: no element matches {target}
- Fix: Pass an element, an id ("map") or a selector ("#map") that exists when the picker is created.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: {value} is not a coordinate
- Fix: Pass "lat,lng" (latitude first), e.g. "48.8584,2.2945", or {lat, lng}.
- Level:
error(logged withconsole.errorwhen unhandled) - Message: invalid option {option}
- Fix: Check the option name and value against the LocationPickerOptions docs.
- Level:
error(logged withconsole.errorwhen unhandled) - Message: the map engine is not loaded
- Fix: Load Leaflet first, pass engine: L, or remove engine-url="none".
- Level:
error(logged withconsole.errorwhen unhandled) - Message: the map engine could not be loaded from {url}
- Fix: Check the network and the CSP script-src, or self-host the engine and set engine-url.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: the map engine CSS is missing
- Fix: Load leaflet.css on the page, set engine-css-url, or allow https://cdn.jsdelivr.net.
- Level:
error(logged withconsole.errorwhen unhandled) - Message: Google Maps needs an API key
- Fix: Add api-key="YOUR_KEY", or load the Google Maps JS API before the picker.
- Level:
error(logged withconsole.errorwhen unhandled) - Message: Google Maps rejected the API key
- Fix: Check the key's HTTP-referrer restrictions, billing, and that Maps JavaScript API is enabled.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: marker="advanced" needs a Google map ID; showing the CSS pin
- Fix: Set map-id (mapId), or use marker="pin".
- Level:
error(logged withconsole.errorwhen unhandled) - Message: this geocoder may not be shown on a {provider} map
- Fix: Use the provider's paired geocoder; Google's terms forbid mixing Google and non-Google content.
- Level:
error(logged withconsole.errorwhen unhandled) - Message: no geocoder is available
- Fix: Remove geocoder: false, or pass a geocoder.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: the geocoding request failed
- Fix: Check the network and the service's rate limits; use your own geocoder in production.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: geolocation is not available here
- Fix: Serve the page over HTTPS, and add allow="geolocation" to a containing iframe.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: location permission was denied
- Fix: Allow location access in the browser's site settings, or pick the point on the map.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: the position could not be determined
- Fix: Try again (Wi-Fi helps), or pick the point on the map.
- Level:
warn(logged withconsole.warnwhen unhandled) - Message: finding the position took too long
- Fix: Try again, or raise geolocation.timeout.
- Level:
silent(never logged) - Message: the operation was aborted
- Fix: Nothing to fix: the picker was destroyed or a newer request replaced this one.