# backup-failed

A part of the backup **holds an error**, so creating it had failed.

- **Route:** `restore-backup`
- **Description:** `backup failed: a part holds the error that ended it when it was created`
- **Details:** **`part`**, the place of the part in the backup, counting from 0, with the full backup as part 0.

## Why It Happens

When creating a **[backup](/docs/eventsourcingdb/backup-and-restore)** fails after it has begun, for example because the server shuts down while the backup runs, its stream holds an **`error` item** before its `end` item. Such a part **lacks the events after the error**, so a restore refuses it, whether it holds an `error` item of the v2 API or an `error` line of a backup that the v1 API created.

Usually, the backup was kept **without checking its last items**.

## How to Fix It

Create the backup again from that part on, and keep a part only if its stream holds no `error` item. EventSourcingDB has removed what it restored so far, so the database is empty again. Resending the request unchanged fails the same way.

## Example

For a restore whose full backup ended with an error when it was created, 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/backup-failed",
    "description": "backup failed: a part holds the error that ended it when it was created",
    "details": {
      "part": 0
    }
  }
}
```
