Docs / EventSourcingDB / Errors / store-read-only

store-read-only

The database is in read-only mode and refuses every write.

  • Routes: write-events, register-event-schema, restore-backup, and import-events
  • Description: store is read-only: it refuses writes until it is restarted without read-only mode
  • Details: operation, which is always write.

Why It Happens#

Read-only mode was switched on, either when the server started, with the --read-only flag, or while it ran, through the route enable-read-only-mode. Reading, observing, and every other route that does not write go on as usual.

If writes are refused for another reason as well, the error names the one that takes the most to lift: server-shutting-down, while the server shuts down, and store-failed, after a failure to store a write, are reported instead of store-read-only, and store-read-only instead of disk-full and restore-in-progress.

How to Fix It#

Restart the server without read-only mode: without the --read-only flag, and, if it was switched on through the API, simply by restarting it, since that mode ends with the next start. Resending the write before then fails the same way.

Example#

For a write while the database is in read-only mode, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its end item:

{
  "type": "error",
  "data": {
    "code": "https://docs.eventsourcingdb.io/errors/store-read-only",
    "description": "store is read-only: it refuses writes until it is restarted without read-only mode",
    "details": {
      "operation": "write"
    }
  }
}