# Cloudflare explains a rare Hyperdrive MySQL caching bug behind empty query results

published: 2026-10-14T14:06:10.308Z
topic: infrastructure
source: https://blog.cloudflare.com/hyperdrive-mysql/
url: https://aiagentnews.io/stories/cloudflare-explains-a-rare-hyperdrive-mysql-caching-bug-behind-empty-query

Cloudflare has made Hyperdrive support for MySQL generally available after fixing about 20 bugs found during the beta. The most subtle of them caused rare empty query responses on Hyperdrive instances with caching enabled.

Hyperdrive is Cloudflare's connection pooler for Workers, and its MySQL support was previously in beta. Early reports included emoji being returned incorrectly, which Cloudflare traced to utf8 being an alias for utf8mb3 rather than full UTF-8, and it switched the handshake to utf8mb4. A later issue was that COM_RESET_CONNECTION resets the connection to the server default character set instead of the negotiated one, so Cloudflare now sets the encoding to utf8mb4 after every reset.

Cloudflare's highest-volume MySQL beta customer saw a small, steady rate of empty responses where results were expected. The problem occurred only on instances with caching enabled and about 0.001% of the time. The cause was an assumption in the Client node's caching code, carried over from Postgres, that the exact bytes written to the Worker could be cached. MySQL capability translation makes those bytes differ from what the Endpoint expects, so when both nodes share a data center cache, one can read a response encoded for the other.

Cloudflare fixed this by always writing a canonical version of query results to the cache, encoded with Hyperdrive's own capabilities, regardless of which node stored it. After the change, the empty row problem stopped and Client connection success reached 99.99%. Hyperdrive MySQL support can be enabled through the dashboard or Wrangler, including for PlanetScale databases.

## Why it matters if you build agents

If you use Hyperdrive with MySQL and caching enabled, the empty-result and hang failures described in the post should no longer occur after this fix, and MySQL support is now covered by GA.

Developers who rely on query caching should be aware that cached responses depend on the connection's capabilities, which matters if you run your own pooling or caching layer against MySQL.

Watch for character set defaults on MySQL servers: connection resets can silently revert encoding, so setting utf8mb4 explicitly after a reset avoids corrupted text such as emoji.
