Repository navigation
fix(api): report an unavailable cache as a 503 - #14863
Conversation
Since #14642, a purge the circuit breaker cannot confirm throws Utopia\Cache\Exception\Unavailable. The error hook had no case for it, so it reached clients as a 500 general_unknown that SDKs do not retry. Map it to a new general_cache_unavailable (503). It is not described as "not applied": a purge after the commit can fail too, so the client is told to read the affected resources back before retrying. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No issues found — approved ✅. This change introduces a new public error code for when the cache backend is unavailable, mapping the cache's
Reviewed commit: 0854e48 |
New ConsoleProject ID: Tip Each function runs in its own isolated container with custom environment variables |
🟢 Tier S · Ready to mergeMaps
📂 Walkthrough · 4
Merged |
commit: |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…-503 fix(api): report an unavailable cache as a 503 (cherry picked from commit 965de7b)

Problem
Since #14642, a purge the cache circuit breaker cannot confirm throws
Utopia\Cache\Exception\Unavailable. The error hook inapp/controllers/general.phphas no case for it, so it reaches clients as a500 general_unknownthat SDKs do not retry.In Appwrite Cloud this happens on
/v1/regions/cacheand on any write whose post-commit purge fails. On 2026-10-22 22:30Z one Dragonfly reload in nyc produced a burst of these: CLOUD-3RB2, CLOUD-3R9E, CLOUD-3R9M.Fix
Map
Unavailableto a newgeneral_cache_unavailableerror (503). This is the mapping half of #14643, which now conflicts withmain. The other half of #14643, makingsave/saveManythrow, is left out (see below).The description does not say the request was "not applied". A purge that runs after the commit can fail too, so the client is told to read the affected resources back before retrying.
Not included: throwing from
save#14643 also makes a refused
savethrow. utopia-php/database#1041 now depends onsavereturningfalsefor cache-owner registration: when registration fails, the write continues behind a tombstone. A throwingsavewould refuse that write instead. That half needs rethinking against the current database design before it lands.Tests
No unit test: the mapping lives in the error-hook closure, and an E2E would need the cache to fail mid-request. The new error code is documented in the response-codes table.
🤖 Generated with Claude Code