# store-read-only

The database is in **[read-only mode](/docs/eventsourcingdb/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`](/docs/eventsourcingdb/errors/server-shutting-down)**, while the server shuts down, and **[`store-failed`](/docs/eventsourcingdb/errors/store-failed)**, after a failure to store a write, are reported instead of `store-read-only`, and `store-read-only` instead of **[`disk-full`](/docs/eventsourcingdb/errors/disk-full)** and **[`restore-in-progress`](/docs/eventsourcingdb/errors/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:

```json
{
  "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"
    }
  }
}
```
