Help with inconsistent errors using WarpedVRT/rio_tiler



I have been running into some puzzling errors with windowed reads of COGs in Mollweide crs.

The read raises a CPLE_AppDefinedError on transforming the window to the dataset crs the first five (5) times it is called, then it succeeds. This implies to me that there might be some behavior that is affected by caching, or with an error suppression logic in rio core. I believe the errors are raised in the first place because the COG bounds become (inf, inf, inf, inf) when transformed from Mollweide to WGS84. However, this does not affect the eventual success of the reads. The error occurs in `rasterio._base()._transform()`.

Here is a simple script to reproduce the errors.
import rasterio as rio
from import COGReader

arr = None
while arr is None:
        with COGReader('') as cog:
            reader = cog.part((10,10,20,20))
            arr =
    except Exception as e:


acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
Reprojection failed, err = -19, further errors will be suppressed on the transform object.
(1, 1013, 1013)

rasterio: 1.2.4
rio_tiler: 2.1.0
gdal: 3.3.0


Join to automatically receive all group messages.