Nine of my public health dashboards broke on the same day, in the same way, with nothing in the browser console to explain it. The cause was not in my code.
If you build public health maps in Python, you have almost certainly written this line:
m = folium.Map(location=[47.5, -100.5], zoom_start=7, tiles="CartoDB positron")
It is Folium's recommended light basemap and the default choice in most epidemiology tutorials. It is also, as of recently, broken — and broken in the most awkward way possible: silently.
CARTO ended keyless access to its raster basemap tiles. Folium requests tiles from:
https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png
CARTO now answers that request with a placeholder image stamped "API KEY REQUIRED" instead of the real map tile. The critical detail is that the request still succeeds — HTTP 200, valid PNG, correct content type. Nothing throws. Nothing is logged. Leaflet receives what it asked for and dutifully tiles the watermark across your study area.
This is also why it hit so many repositories at once. Every map built with
tiles="CartoDB positron" — the most common choice in the field —
points at the same URL. It was never nine separate bugs. It was one upstream
policy change with nine downstream symptoms.
Esri's World Light Gray Canvas is free, needs no key, and is visually close enough to CartoDB Positron that most readers will not notice the swap:
https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}
A find-and-replace on the hostname will not work. Three things have to change together:
{z}/{y}/{x}, not {z}/{x}/{y}.
Swap only the hostname and you get a map that loads perfectly and is
scrambled — arguably worse than a blank one, because it looks like data.
subdomains must be emptied. Esri has no
{s} sharding. Leaving Folium's default "abcd" in
place produces dead tile requests against hostnames that do not exist.
maxNativeZoom must drop to 16. Esri's gray canvas
stops at z16. Left at 20, users who zoom in get blank tiles; set to 16,
Leaflet upscales the z16 tile instead and the map stays usable.
In Python, the durable version:
import folium, xyzservices.providers as xyz
gray = xyz.Esri.WorldGrayCanvas
m = folium.Map(
location=[47.5, -100.5], zoom_start=7,
tiles=gray.build_url(), attr=gray.html_attribution,
max_native_zoom=16,
)
Letting xyzservices supply the URL and attribution means you stay
current if Esri changes anything. It also exposes
requires_token(), so you can assert a provider is keyless
before building the map and catch this whole class of failure at
build time rather than in a stakeholder meeting.
Patching the exported index.html fixes today's dashboard and
nothing else. Those files are build output. The next time you re-run the
notebook, Folium reinserts the CARTO tiles. Change the map constructor in the
source, not the artifact.
I went looking for the CARTO problem and found two worse ones in the same set of dashboards. Both are the same shape of mistake.
One dashboard loads React, Babel, Recharts, Tailwind and an icon library from
CDNs at page load, and pulls its data from a third-party ArcGIS feature service
I do not control. Rendered with those blocked, the page is completely
blank — no error, no fallback, no cached last-known state. The icon
library is pinned to @latest, which means a breaking release
upstream silently kills a public health dashboard with no action on my part.
Another inlines the entire plotting library into a 23 MB HTML file, yet still fetches its geographic boundaries from a CDN at render time. Block that one request and the colorbars and title draw perfectly around an empty map.
The pattern worth naming: we routinely build surveillance tools whose availability depends on services we have no agreement with. A dashboard that informs a licensing decision or a shelter-capacity investment is infrastructure, and we tend not to treat it that way. Three habits fix most of it:
@latest is a
scheduled outage with an unknown date.Ctrl/Cmd + Shift + R) — the watermarked tiles cache aggressively,
so a correct fix can look like a failed one for several minutes.
Nothing above is difficult. It cost a day to diagnose only because the failure
mode was a successful HTTP response, and because my first hypothesis was wrong:
I initially blamed a missing Mapbox token in an unrelated dashboard, and only
disproved it by rendering the page in a headless browser and reading what
actually got requested. The string "mapbox" appeared in the file,
but inside the plotting library's template defaults — not in any live trace.
That is worth stating plainly, because the diagnostic lesson is more transferable than the fix: when a map looks wrong, check what the browser requested, not what the source code mentions.