Subprocess & Environment
7. The Wrong Interpreter in a Fallback Chain.
Copernicus wind / current / SST overlays rendered as "degraded, empty frames." The gateway logs showed the rendering subprocess exiting with ModuleNotFoundError. The overlay subprocess runs copernicusmarine.subset under a chosen interpreter, and the selection logic blindly trusted the first candidate that existed.
The Fix: The fallback chain was (1) an env var, (2) a cached bundled runtime, (3) sys.executable. The bundled runtime existed but lacked the copernicusmarine package—so the subprocess picked it, failed the import, and returned an empty placeholder, while the system Python that did have the package sat unused. I capability-check before committing: test each candidate with importlib.util.find_spec(...) and use the first that actually has it. Lesson: capability-test before you trust—the "better" cached option may be incomplete.