Skip to content

Migrate raster:bands -> bands fails with earth_search S2_MSI_L2A_COG #2169

@remi-braun

Description

@remi-braun

Describe the bug
Migrate raster:bands -> bands fails with earth_search provider and S2_MSI_L2A_COG collection

Code To Reproduce

import os
from eodag import EODataAccessGateway, setup_logging

os.environ["EODAG__EARTH_SEARCH__AUTH__CREDENTIALS__AWS_ACCESS_KEY_ID"] = "xxx"
os.environ["EODAG__EARTH_SEARCH__AUTH__CREDENTIALS__AWS_SECRET_ACCESS_KEY"] = "yyy"
os.environ["EODAG_PROVIDERS_WHITELIST"] = "earth_search"

if __name__ == "__main__":
    setup_logging(3)  # DEBUG level

    # Create gateway
    dag = EODataAccessGateway()
    dag.set_preferred_provider("earth_search")

    # Query all
    products = dag.search_all(
        start='2025-02-08T00:00:00',
        end='2025-02-11T00:00:00',
        **{
            "collection": "S2_MSI_L2A_COG",
            "grid:code": 'MGRS-32ULU'
        }
    )

Output

2026-04-30 14:57:56,374 eodag.config                     [DEBUG   ] Loading configuration from C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\resources\providers.yml
2026-04-30 14:57:56,918 eodag.plugins.manager            [DEBUG   ] EcmwfApi plugin skipped, eodag[ecmwf] or eodag[all] needed
2026-04-30 14:57:56,942 eodag.plugins.manager            [DEBUG   ] CSWSearch plugin skipped, eodag[csw] or eodag[all] needed
2026-04-30 14:57:56,957 eodag.provider                   [INFO    ] Loading user configuration from: C:\Users\rbraun\.config\eodag\eodag.yml
2026-04-30 14:57:56,973 eodag.provider                   [DEBUG   ] Loading configuration from environment variables
2026-04-30 14:57:56,985 eodag.core                       [INFO    ] Locations configuration loaded from C:\Users\rbraun\.config\eodag\locations.yml
2026-04-30 14:57:57,145 eodag.core                       [INFO    ] Searching on provider earth_search
2026-04-30 14:57:57,177 eodag.search.base                [DEBUG   ] Validate request
2026-04-30 14:57:57,244 eodag.search.base                [INFO    ] earth_search is configured with default sorting by 'start_datetime' in ascending order
2026-04-30 14:57:57,244 eodag.search.base                [DEBUG   ] Mapping eodag collection to provider collection
2026-04-30 14:57:57,245 eodag.search.qssearch            [DEBUG   ] Building the query string that will be used for search
2026-04-30 14:57:57,245 eodag.product.metadata_mapping   [DEBUG   ] Retrieving queryable metadata from metadata_mapping
2026-04-30 14:57:57,246 eodag.search.qssearch            [INFO    ] Sending search request: https://earth-search.aws.element84.com/v1/search
2026-04-30 14:57:57,246 eodag.search.qssearch            [DEBUG   ] Query parameters: {"query": {"mgrs:utm_zone": {"eq": "32"}, "mgrs:latitude_band": {"eq": "U"}, "mgrs:grid_square": {"eq": "LU"}}, "datetime": "2025-02-08T00:00:00.000Z/2025-02-11T00:00:00.000Z", "collections": ["sentinel-2-l2a"], "sortby": [{"field": "properties.datetime", "direction": "asc"}], "limit": 500, "page": "1"}
2026-04-30 14:57:57,246 eodag.search.qssearch            [DEBUG   ] Query kwargs: {}
2026-04-30 14:57:57,833 eodag.search.qssearch            [DEBUG   ] Next page merge collected and set for the next search
2026-04-30 14:57:57,851 eodag.search.qssearch            [DEBUG   ] Adapting 1 plugin results to eodag product representation
2026-04-30 14:57:57,873 eodag.core                       [ERROR   ] Error while searching on provider earth_search (ignored):
Traceback (most recent call last):
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\api\core.py", line 1869, in _do_search
    search_result = search_plugin.query(prep, **search_params)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\plugins\search\qssearch.py", line 1848, in query
    eo_products_normalize = self.normalize_results(provider_results, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\plugins\search\qssearch.py", line 1863, in normalize_results
    normalized = super().normalize_results(results, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\plugins\search\qssearch.py", line 1339, in normalize_results
    product._normalize_bands()
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\api\product\_product.py", line 434, in _normalize_bands
    normalize_bands(self.assets[key])
  File "C:\Users\rbraun\Anaconda3\envs\eodownload\Lib\site-packages\eodag\api\product\metadata_mapping.py", line 1870, in normalize_bands
    band = processed_bands[index]
           ~~~~~~~~~~~~~~~^^^^^^^
IndexError: list index out of range

Environment:

  • Python version: Python 3.11.14
  • EODAG version: eodag (Earth Observation Data Access Gateway): version 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions