Arequests fails with MBEDTLS_ERR_X509_FATAL_ERROR

Hi Vobot developers,

My app has been running with arequests successfully for a long time. But recently it fails with the following error. It looks like something wrong with the built-in certificates. I tried updating the code to use urequests instead and it works flawlessly.

Any idea what is causing the failure in arequests recently? Thanks!

2026-11-30 11:18:16 I (3951917) REQS: connecting to https://data.weather.gov.hk:443/weatherAPI/hko_data/regional-weather/latest_1min_temperature.csv
2026-11-30 11:18:16 D (3951918): system busy begin
2026-11-30 11:18:16 D (3951937) USTREAM: IP: 103.30.70.56
2026-11-30 11:18:16 48 certificates in bundle
2026-11-30 11:18:16 Certificate not found in storage
2026-11-30 11:18:16 Failed to verify certificate
2026-11-30 11:18:16 D (3951956): system busy end
2026-11-30 11:18:16 E (3951956) REQS: OSError -12288
2026-11-30 11:18:16 Traceback (most recent call last):
2026-11-30 11:18:16 File “arequests.py”, line 170, in request
2026-11-30 11:18:16 File “asyncio/funcs.py”, line 1, in wait_for
2026-11-30 11:18:16 File “asyncio/funcs.py”, line 1, in _run
2026-11-30 11:18:16 File “asyncio/core.py”, line 1, in run_until_complete
2026-11-30 11:18:16 File “asyncio/stream.py”, line 1, in open_connection
2026-11-30 11:18:16 OSError: (-12288, ‘MBEDTLS_ERR_X509_FATAL_ERROR’)
2026-11-30 11:18:16 E (3951956) REQS: https://data.weather.gov.hk/weatherAPI/hko_data/regional-weather/latest_1min_temperature.csv request failed.

Hi Andy,

Thanks for the detailed log, it made this easy to track down. The key line is Certificate not found in storage: the certificate currently served by data.weather.gov.hk (issued on Nov 27) chains to Hongkong Post Root CA 3, which is not in the Dock’s built-in certificate store. That’s why arequests fails TLS verification. Your code and the HKO API itself are fine.

You can keep using arequests and skip certificate verification for these requests:

resp = await arequests.get(url, timeout=NETWORK_TIMEOUT, verify=False)

We tested this on a Dock against the same URL, and it returns the data normally while keeping your code async. Note that with verify=False the server’s identity isn’t checked, which is generally acceptable for public weather data.

Since HK Weather is on the App Gallery, publishing an update with this change would get it working again for everyone using your app.

Thanks for the solution! Just curious, why urequests works correctly when arequests fails? Are they using the same set of certificates?