Skip to content

Surface an error when the worker script fails to load (#8018) - #8089

Closed
clement-igonet wants to merge 4 commits into
maplibre:mainfrom
clement-igonet:fix/worker-load-error-8018
Closed

Surface an error when the worker script fails to load (#8018)#8089
clement-igonet wants to merge 4 commits into
maplibre:mainfrom
clement-igonet:fix/worker-load-error-8018

Conversation

@clement-igonet

Copy link
Copy Markdown
Contributor

When the worker script fails to load (wrong setWorkerUrl(), missing self-hosted bundle, blocked import), the map now says so instead of hanging silently: the map fires an error event with an actionable message, and the console shows the same with the worker URL. Only an error arriving before the worker's first message is treated as a load failure, so runtime errors of a healthy worker are not affected.

On the issue's repro, instead of nothing:

MapLibre: The map's worker script failed to load. Sources that depend on the worker (vector tiles, GeoJSON) cannot be processed and the map may never fire "load". When bundling or self-hosting, point setWorkerUrl() at a reachable copy of the worker bundle; see the v5-to-v6 migration guide. Worker URL: ./does-not-exist-worker.mjs

Also fixes the silent hang analyzed in #8074.

Launch Checklist

Assisted-By: Claude (claude-fable-5)

A worker error arriving before its first message is a script load failure:
report it on the console from the worker factory and fire the map error
event through the dispatcher, instead of hanging silently.

Assisted-By: Claude <noreply@anthropic.com>
…opy in the worker mock, drop unneeded assertions, update bundle size

Assisted-By: Claude <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.37%. Comparing base (71480b6) to head (8f7294e).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8089      +/-   ##
==========================================
+ Coverage   93.33%   93.37%   +0.04%     
==========================================
  Files         291      291              
  Lines       24603    24631      +28     
  Branches     6494     6497       +3     
==========================================
+ Hits        22962    22998      +36     
+ Misses       1641     1633       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HarelM

HarelM commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

This is just rude now.
There's an open issue and an open PR linked to that issue.
Please stop this AI madness.

@HarelM HarelM closed this Aug 3, 2026
@clement-igonet

Copy link
Copy Markdown
Contributor Author

This is just rude now. There's an open issue and an open PR linked to that issue. Please stop this AI madness.

#8024 was already open for this and I should have checked before opening anything. Closing was correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants