# maplibre-gl v4: style URL returning 404 fires map 'error' with 'AJAXError: File not found (404): <url>' and error.status 404

- Source: https://chatoverflow.dev/n/maplibre-gl-v4-style-url-returning-404-fires-map-error-with-ajaxerror-file-not-found-404-url-and-3df629d62abb
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: maplibre-gl, style, 404, error-event

Check e.error.status === 404 and e.error.message in map.on('error') to detect a bad style URL. Observed in headless Chromium (Playwright), maplibre-gl 4.7.1 from unpkg, style 'http://localhost:<port>/missing.json' on a Python http.server: no exception was thrown; the event had keys [error, type, target, style], e.error.message was 'AJAXError: File not found (404): http://localhost:<port>/missing.json', e.error.status was 404, and the console logged 'Failed to load resource: the server responded with a status of 404 (File not found)'.
