Skip to content

Error Codes Reference

All API errors are instances of MapstedError, which extends the standard Error class with a structured MAPSTED-1xxx code.

ts
import { MapstedError } from '@mapsted/maps-js-api';

try {
  await maps.navigateToFloorById(999);
} catch (err) {
  if (err instanceof MapstedError) {
    console.error(err.code);    // e.g. "MAPSTED-1040"
    console.error(err.message); // human-readable interpolated message
  }
}

Each error has a recoverable flag. Recoverable errors indicate a transient condition where retrying (after taking corrective action) may succeed. Non-recoverable errors indicate programming mistakes or permanent configuration problems.


Initialisation — 1000–1009

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1000ERR_INIT_FAILEDNoMapsted Maps JavaScript API initialisation failed: {reason}Check the reason field for the root cause. Common causes: DOM not ready, iframe blocked by CSP.
MAPSTED-1001ERR_ALREADY_INITIALISEDNoMapsted Maps JavaScript API is already initialised. Call destroy() before re-initialising.Call destroy() before calling init() a second time.

Configuration — 1010–1019

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1010ERR_MISSING_PROPERTY_IDNopropertyId is required in Mapsted Maps JavaScript API configuration.Supply propertyId in InitOptions when using npm mode.
MAPSTED-1011ERR_INVALID_MAPS_DOMAINNomapsDomain '{domain}' is not a valid Mapsted Maps domain.Provide a valid absolute URL for the maps backend (e.g. https://maps.mapsted.com).
MAPSTED-1012ERR_MISSING_REQUIRED_PARAMNoRequired parameter '{parameter}' is missing or null.Supply the named parameter. Check the method signature for required fields.
MAPSTED-1013ERR_INVALID_PARAM_TYPENoParameter '{parameter}' expected type '{expected}' but received '{actual}'.Pass the correct type. expected and actual in the message describe the mismatch.

Iframe / DOM — 1020–1029

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1020ERR_IFRAME_NOT_FOUNDNoTarget iframe element not found. Verify the selector: '{selector}'.Ensure the container element exists in the DOM before calling init().
MAPSTED-1021ERR_IFRAME_NOT_READYYesiframe has not completed loading. Await the READY event before sending commands.Wait for the load event or the onload callback before calling command methods.

Communication — 1030–1039

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1030ERR_COMMAND_TIMEOUTYesCommand '{action}' timed out after {ms}ms (requestId: {requestId}).The iframe did not respond within 10 s. Verify the map is fully loaded. Retry after confirming isReady().
MAPSTED-1031ERR_POSTMESSAGE_FAILEDNopostMessage delivery failed. iframe may have been destroyed.Check that destroy() was not called before the command. Re-initialise if needed.

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1040ERR_INVALID_FLOOR_IDNoFloor ID '{floorId}' is not valid for property '{propertyId}'.Use getFloors() to retrieve valid floor IDs for the current property.
MAPSTED-1041ERR_INVALID_FLOOR_NAMENoFloor name '{floorName}' not found in property '{propertyId}'.Verify the floor name against getFloors() results. Names are case-sensitive.
MAPSTED-1042ERR_INVALID_BUILDING_IDNoBuilding ID '{buildingId}' is not valid for property '{propertyId}'.Confirm the building ID from the Mapsted Hub or CMS.
MAPSTED-1043ERR_INVALID_VIEWPORTNoViewport parameters are invalid: {reason}.Ensure zoomLevel is 10–24 and mapCenter is [lng, lat] with lng ∈ [−180, 180] and lat ∈ [−90, 90].

Quota — 1050

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1050ERR_QUOTA_EXCEEDEDYesAPI quota exceeded for tier '{tier}'. Retry after {retryAfter}.Implement exponential back-off. retryAfter is an ISO 8601 duration string (e.g. PT30S). Upgrade your plan if the limit is reached regularly.

POI — 1060–1069

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1060ERR_POI_NOT_FOUNDNoPOI '{poiId}' not found in property '{propertyId}'.The entity ID does not exist in the current property. Verify the ID from the Mapsted Hub.
MAPSTED-1061ERR_INVALID_ENTITY_DATANoEntity data is invalid: {reason}.setEntityData() / setEntityDataById() / setEntityDefaults() require a plain MapEntity object. Arrays and non-objects are rejected.
MAPSTED-1062ERR_INVALID_COORDS_DATANoCoordinates data is invalid: {reason}.Ensure each element in the CoordsData[] array has valid lat, long, and floor fields.

Wayfinding — 1070–1079

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1070ERR_ROUTE_NOT_FOUNDNoNo route found between POI '{origin}' and POI '{destination}'.The map graph has no path between these entities. Check that both are on a connected floor plan.
MAPSTED-1071ERR_INVALID_ROUTING_CONFIGNoRouting configuration is invalid: {reason}.Validate the Boost object shape. RoutingBoost requires a non-empty routing string; SelectEntityBoost requires a numeric entity field.
MAPSTED-1072ERR_INVALID_ACCESSIBILITY_MODENoAccessibility mode value must be a boolean, received '{value}'.Pass true or false to setAccessibilityMode().

Search — 1080–1089

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1080ERR_INVALID_OVERLAY_MARKERSNoOverlay markers data is invalid: {reason}.Pass an array to setMapOverlayMarkers().
MAPSTED-1081ERR_OVERLAY_NOT_FOUNDNoMap overlay '{overlayId}' not found.Confirm the overlay ID from the Mapsted CMS. IDs are case-sensitive.
MAPSTED-1082ERR_INVALID_LANGUAGE_CODENoLanguage code '{code}' is not a valid BCP 47 language tag.Use a valid BCP 47 tag such as "en", "fr", or "zh-Hans".
MAPSTED-1083ERR_INVALID_FEATURE_FLAGSNoFeature flags object is invalid: {reason}.Pass a plain object to setFeatureFlags(). Arrays are rejected.
MAPSTED-1084ERR_INVALID_IDLE_TIMENoIdle time must be a positive integer in milliseconds, received '{value}'.Pass a positive integer. Floating-point values and zero are rejected.
MAPSTED-1085ERR_THEME_UNAVAILABLEYesRequested theme is unavailable for this property: {message}.Call getThemes() to retrieve available theme ids. Theme ids are case-sensitive. Use "light" / "dark" aliases for the built-in Mapsted themes.
MAPSTED-1086ERR_BUILDING_NOT_FOUNDYesBuilding '{buildingId}' was not found for this property: {message}.Call getBuildingInfo() with a valid building ID. Confirm the building ID from the Mapsted Hub or CMS for the current property.

State — 1090–1099

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1090ERR_NOT_READYYesCannot call '{method}': Mapsted Maps JavaScript API is not in READY state (current: {state}).Await the load event or check isReady() before calling command methods.
MAPSTED-1091ERR_SUBSCRIBE_INVALID_HANDLERNosubscribe() requires a function handler, received '{type}'.Pass a function reference to subscribe().
MAPSTED-1092ERR_DESTROY_FAILEDNodestroy() failed: {reason}.Inspect the reason field. This may indicate a DOM inconsistency — reload the page.
MAPSTED-1093ERR_METHOD_REMOVEDNoMethod '{method}' was removed in Mapsted Maps JavaScript API {removedIn}. Migration: {migration}.Follow the migration guide in the error message. See the Changelog.

Authentication — 1200–1299

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1200ERR_API_KEY_INVALIDNoAPI key is invalid or has been revoked.Check your access key in the Mapsted Hub. Generate a new key if revoked.
MAPSTED-1201ERR_API_KEY_EXPIREDNoAPI key expired on {expiry}. Renew at developers.mapsted.com.Log in to developers.mapsted.com and renew the key before the next deployment.

Network — 1300–1399

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1310ERR_CSP_FRAME_BLOCKEDNoMap iframe was blocked or failed to load. Embedding is governed by two CSP directives: (1) your page's CSP frame-src must allow the map origin '{expectedFrameSrc}'; (2) the Mapsted map app's CSP frame-ancestors must allow this page's origin '{parentOrigin}'. If your site is not on a *.mapsted.* domain the map app may be refusing the embed — contact Mapsted.Add the Mapsted domain to your page's Content-Security-Policy: frame-src directive. Example: frame-src https://mapi.mapsted.com. If your site is not on a *.mapsted.* domain, contact Mapsted so the map app's frame-ancestors directive can allow your origin.

Security config — 1300–1399

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1303ERR_SECURITY_CONFIG_ORIGIN_MISMATCHNoSecurityConfig rejected message from origin '{origin}'. Expected one of: {expected}.A postMessage was received from an origin not in the security.allowedOrigins + security.additionalOrigins whitelist. Verify your security config in InitOptions or add the origin to additionalOrigins.

Note: In production the expected field (the full origin whitelist) is redacted from the error message to prevent origin disclosure. Pass strict: true in InitOptions during development to see the unredacted value.


Security — 1400–1409

CodeSymbolic nameRecoverableMessage templateResolution
MAPSTED-1400ERR_ORIGIN_NOT_ALLOWEDNoMessage from origin '{origin}' rejected. Expected '{expected}'.A postMessage was received from an unexpected origin. This may indicate a misconfigured mapsDomain or a security intrusion attempt. Verify your mapsDomain value.

Note: In production the expected field is redacted from the error message to prevent origin disclosure. Enable strict mode (setStrictMode(true)) in development to see the full value.


AI Assistant — 1500–1509

The MAPSTED-1500MAPSTED-1509 range is reserved for a future release. The AI assistant is not available in 4.0.1, so these codes are not emitted by the current release.


Error code ranges summary

RangeCategory
1000–1009Initialisation
1010–1019Configuration
1020–1029Iframe / DOM
1030–1039Communication (postMessage)
1040–1049Navigation
1050–1059Quota
1060–1069POI / Entity
1070–1079Wayfinding / Routing
1080–1089Overlays and UI
1090–1099API state
1200–1299Authentication
1300–1399Network / Security config
1400–1409Security (origin)
1500–1509AI Assistant