The problem - not able to open h5ad files, cellxgene gateway fails with:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
Steps to reproduce:
mkdir /tmp/cxgw && cd /tmp/cxgw/ && wget https://raw.githubusercontent.com/Novartis/cellxgene-gateway/refs/heads/master/Dockerfile
docker build -t cellxgene-gateway .
mkdir /tmp/cxgw_data
wget https://github.com/chanzuckerberg/cellxgene/raw/main/example-dataset/pbmc3k.h5ad -O /tmp/cxgw_data/pbmc3k.h5ad
docker run -it --rm -v /tmp/cxgw_data/:/cellxgene-data -p 5005:5005 cellxgene-gateway
2025-10-29 12:09:21,963:cellxgene_gateway:INFO:Got required env: {'CELLXGENE_LOCATION': '/usr/local/bin/cellxgene'}
2025-10-29 12:09:21,963:cellxgene_gateway:INFO:Got optional env: {'EXTERNAL_HOST': 'localhost:5005', 'EXTERNAL_PROTOCOL': None, 'GATEWAY_IP': None, 'GATEWAY_PORT': 5005, 'GATEWAY_EXTRA_SCRIPTS': None, 'GATEWAY_EXPIRE_SECONDS': 3600, 'GATEWAY_ENABLE_ANNOTATIONS': False, 'GATEWAY_ENABLE_BACKED_MODE': False, 'GATEWAY_LOG_LEVEL': 20, 'CELLXGENE_ARGS': None, 'CELLXGENE_DATA': '/cellxgene-data', 'PROXY_FIX_FOR': 0, 'PROXY_FIX_PROTO': 0, 'PROXY_FIX_HOST': 0, 'PROXY_FIX_PORT': 0, 'PROXY_FIX_PREFIX': 0}
* Serving Flask app 'cellxgene_gateway.gateway'
* Debug mode: off
2025-10-29 12:09:21,968:werkzeug:INFO:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5005
* Running on http://172.17.0.4:5005
2025-10-29 12:09:21,968:werkzeug:INFO:Press CTRL+C to quit
an attempt to open a file via a browser returns 500 Internal Server Error and the following log file form the cellxgene-gateway instance in the Docker:
2025-10-29 12:09:42,365:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:42] "GET /filecrawl.html HTTP/1.1" 200 -
2025-10-29 12:09:42,390:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:42] "GET /static/js/annotation.js HTTP/1.1" 200 -
2025-10-29 12:09:42,434:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:42] "GET /static/nibr.ico HTTP/1.1" 200 -
view path=pbmc3k.h5ad/, source_name=None, dataset=/cellxgene-data/pbmc3k.h5ad, annotation_file= None, key=pbmc3k.h5ad, source=local
2025-10-29 12:09:44,302:cellxgene_gateway.subprocess_backend:INFO:launching yes | /usr/local/bin/cellxgene launch /cellxgene-data/pbmc3k.h5ad --port 8000 --host 127.0.0.1 --disable-annotations --disable-gene-sets-save
2025-10-29 12:09:45,305:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:45] "GET /view/pbmc3k.h5ad/ HTTP/1.1" 200 -
2025-10-29 12:09:45,387:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:45] "GET /view/pbmc3k.h5ad/nibr.png HTTP/1.1" 200 -
2025-10-29 12:09:50,406:cellxgene_gateway.gateway:ERROR:Exception on /view/pbmc3k.h5ad/ [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cellxgene_gateway/gateway.py", line 214, in do_view
return match.serve_content(path)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cellxgene_gateway/cache_entry.py", line 193, in serve_content
cellxgene_response.content.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
2025-10-29 12:09:50,409:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:50] "GET /view/pbmc3k.h5ad/ HTTP/1.1" 500 -
2025-10-29 12:09:50,474:werkzeug:INFO:172.17.0.1 - - [29/Oct/2025 12:09:50] "GET /favicon.ico HTTP/1.1" 304 -
Also reported and closed? here: #94
The problem - not able to open h5ad files, cellxgene gateway fails with:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byteSteps to reproduce:
an attempt to open a file via a browser returns 500 Internal Server Error and the following log file form the cellxgene-gateway instance in the Docker:
Also reported and closed? here: #94