Skip to main content

I’m getting what seems to be a 404 error from sentinelhub-py when trying to download an image of Sentinel-2 band B04 for a location in tile 48QUE on date 2022-04-03. It works fine for other bands with the same date and location, and it works fine for other dates with the same band and location. It fails for a couple locations that I tried within that tile.


Code to reproduce:

(instance ID and file paths have been modified for privacy)


import datetime
from sentinelhub import WcsRequest, MimeType, DataSource, BBox, CRS
from sentinelhub.config import SHConfig

config = SHConfig()
config.instance_id = 'e847e6a9-c4cf-xxxx-xxxx-xxxxxxxxxxxx'
req = WcsRequest(
config=config,
layer='B04',
bbox=BBox(bbox=(103.5, 17.5, 103.501, 17.501), crs=CRS.WGS84),
resx='10m',
resy='10m',
time='2022-04-03',
time_difference=datetime.timedelta(hours=2),
data_collection=DataSource.SENTINEL2_L1C,
image_format=MimeType.TIFF
)
req.get_dates() # returns sdatetime.datetime(2022, 4, 3, 3, 43, 17)]
req.get_data()

The resulting error:


Traceback (most recent call last):
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/handlers.py", line 43, in new_download_func
return download_func(self, request)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/handlers.py", line 28, in new_download_func
raise exception from exception
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/handlers.py", line 20, in new_download_func
return download_func(self, request)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/sentinelhub_client.py", line 80, in _execute_download
response.raise_for_status()
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://services.sentinel-hub.com/ogc/wcs/e847e6a9-c4cf-xxxx-xxxx-xxxxxxxxxxxx?SERVICE=wcs&WARNINGS=False&MAXCC=100.0&BBOX=17.5%2C103.5%2C17.501%2C103.501&FORMAT=image%2Ftiff&CRS=EPSG%3A4326&TIME=2022-04-03T01%3A43%3A17Z%2F2022-04-03T05%3A43%3A17Z&RESX=10m&RESY=10m&COVERAGE=B04&REQUEST=GetCoverage&VERSION=1.1.2

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/base.py", line 116, in get_data
return self._execute_data_download(
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/base.py", line 175, in _execute_data_download
data_list = client.download(filtered_download_list, max_threads=max_threads, decode_data=decode_data)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/sentinelhub_client.py", line 52, in download
return super().download(*args, **kwargs)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/client.py", line 87, in download
data_listsfuture_orderefuture]] = self._process_download_future(future)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/client.py", line 100, in _process_download_future
raise download_exception.with_traceback(traceback)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/client.py", line 96, in _process_download_future
return future.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 481, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/client.py", line 118, in _single_download
response_content = self._execute_download(request)
File "/home/me/.virtualenvs/venv/lib/python3.8/site-packages/sentinelhub/download/handlers.py", line 57, in new_download_func
raise DownloadFailedException(message) from exception
sentinelhub.exceptions.DownloadFailedException: Failed to download from:
https://services.sentinel-hub.com/ogc/wcs/e847e6a9-c4cf-xxxx-xxxx-xxxxxxxxxxxx?SERVICE=wcs&WARNINGS=False&MAXCC=100.0&BBOX=17.5%2C103.5%2C17.501%2C103.501&FORMAT=image%2Ftiff&CRS=EPSG%3A4326&TIME=2022-04-03T01%3A43%3A17Z%2F2022-04-03T05%3A43%3A17Z&RESX=10m&RESY=10m&COVERAGE=B04&REQUEST=GetCoverage&VERSION=1.1.2
with HTTPError:
500 Server Error: Internal Server Error for url: https://services.sentinel-hub.com/ogc/wcs/e847e6a9-c4cf-xxxx-xxxx-xxxxxxxxxxxx?SERVICE=wcs&WARNINGS=False&MAXCC=100.0&BBOX=17.5%2C103.5%2C17.501%2C103.501&FORMAT=image%2Ftiff&CRS=EPSG%3A4326&TIME=2022-04-03T01%3A43%3A17Z%2F2022-04-03T05%3A43%3A17Z&RESX=10m&RESY=10m&COVERAGE=B04&REQUEST=GetCoverage&VERSION=1.1.2
Server response: "Illegal request to s3://sentinel-s2-l1c-index/tiles/48/Q/UE/2022/4/3/0/B04.index. HTTP Status: 404."

Script of the B04 layer in my Sentinel Hub configuration:


//VERSION=3
// https://docs.sentinel-hub.com/api/latest/user-guides/transition/#use-case-5-formatimagetiffdepth32f

function evaluatePixel(samples) {
if (samples.dataMask==0) return n1]
return nsamples.B04];
}
function setup() {
return {
input: :{
bands: :
"B04",
"dataMask"
]
}],
output: {
bands: 1,
sampleType: "FLOAT32"
}
}
}

Any idea what would be causing this?

Hi @akenney,

We have fixed the corrupt Sentinel 2 product. The request in your code should now work.


It works now, thank you!


Hi, I encountered this same error again for a different scene: “Illegal request to s3://sentinel-s2-l1c-index/tiles/43/S/DR/2022/8/3/0/B04.index. HTTP Status: ‘404’”.


Hi @akenney,


can you try again? And if it does not work, can you send an exemplary request?


Best,

Grega


It works now, thanks!


Reply