# Failures

> What happens when each part of Sypnia Cases fails, and what you see.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://cases.docs.sypnia.com/architecture/failures/

For agents: Failures: database down → API 503, editor read-only from cached version, nothing lost; repository sync fails (token revoked, branch protected) → job retried with backoff 5 times then DLQ, map shows 'not synced since vN' and a fix link, versions never lost; a linked product down → that link shows 'not available', others shown; SMTP down → review e-mails kept in mail_outbox and retried up to 8 times (waits 1, 5, 30 then 120 min), proposals still work; two approvals racing → approvals of one proposal serialized by a row lock, unique (map, number) keeps one version, the loser gets 409 version_conflict; a proposal on an older base merges when no case it touches changed, otherwise 409 version_conflict and it is rebased.

| What fails                                                      | What happens                                                                                                                                              | What you see                                                                                                                       |
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **The database**                                                | the API answers `503 unavailable`; nothing is half-written, because every change is one transaction                                                       | the editor shows the last version it loaded, read-only, and retries                                                                |
| **Writing to the repository** (token revoked, branch protected) | the job is retried with backoff five times, then parked in the dead-letter queue                                                                          | «Not written to the repository since version 5», with a link to fix the connection. The versions themselves are safe in the server |
| **A linked product**                                            | that link is skipped after 2 seconds                                                                                                                      | «Telemetry is not available right now» on that link; the rest shows                                                                |
| **Cases does not take a map uploaded to Data**                  | Sypnia Data keeps the upload for its «Use cases» either way; the forward to the linked Cases map is not retried                                           | `map --upload` says the Cases map did not take it now; upload again, or send it straight to the map with `--project <map>`         |
| **E-mail**                                                      | review e-mails wait in the server's outbox and are retried up to 8 times, with a growing wait (1, 5, 30 minutes, then 2 hours); nothing waits on them     | reviewers still see the proposal in the editor                                                                                     |
| **Two approvals at once**                                       | approvals of one proposal take turns on a row lock, and the version number is unique per map: one wins, the other gets `409 version_conflict`             | at most a short «someone just approved; check again»                                                                               |
| **A proposal made on an older version**                         | it merges on its own when no case it touches changed since its base; otherwise `409 version_conflict`                                                     | «Rebase this proposal»: the cases that changed under it                                                                            |
| **A listening case keeps failing**                              | its delivery is tried 5 times by default (1 to 20, set by the case), with a growing wait, then kept in its dead letters; other listeners are not affected | the dead letters on the event graph, a problem in Telemetry, and `cases dead-letters replay` after the fix                         |
| **A service stops right after a commit**                        | the event is already in the outbox; the sweep publishes it within a minute                                                                                | nothing; the chain goes on a little later                                                                                          |
| **A chain of events loops**                                     | it is cut at depth 10, or when a case repeats beyond its bounded loop: `LoopStopped`                                                                      | a problem and an alert in Telemetry with the whole chain ([Loops](https://cases.docs.sypnia.com/runtime/loops))                    |
| **A bad file in a pull request**                                | the proposal is created with `invalid_map` findings, never merged                                                                                         | the check on the pull request fails, saying the file and the field                                                                 |
