# capacity-exceeded

The events would **exceed the event capacity** of the license.

- **Routes:** `write-events`, `restore-backup`, and `import-events`
- **Description:** `capacity is exceeded: the events would take the store beyond the number of events its license permits`
- **Details:** When writing events, none; `details` is an empty object. When restoring a backup or importing events, **`eventId`**, the ID of the first event of the backup or of the import beyond the capacity.

## Why It Happens

A license permits a **maximum number of events**: the evaluation license, which EventSourcingDB uses without a license of its own, permits **25,000 events**, while a commercial license has no such limit, see **[Limits](/docs/eventsourcingdb/limits#event-limits)**.

A write is refused if the events stored so far **plus the events of the write** exceed that number, and then **none of its events are written**, not even those that would still fit. A restore is refused at the **first event of the backup beyond that number**, which the error names by its ID, and EventSourcingDB removes what it has restored so far, as described in **[When a Restore Fails](/docs/eventsourcingdb/backup-and-restore#when-a-restore-fails)**. An import is refused the same way at the first of its events beyond that number, and EventSourcingDB removes what it has imported so far, and keeps the schemas that were registered before it. A write has no single event at fault, so its error names none.

## How to Fix It

Restart the server with a commercial license, given with `--license-file` or `--license-string`, as described in **[License Management](/docs/eventsourcingdb/managing-configuration-and-secrets#license-management)**. Until then, a write succeeds only if it fits into the capacity that is left, so a smaller write may still go through, while sending the same request again fails the same way.

## Example

For a write of three events to a database with the evaluation license that holds 24,999 events already, 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/capacity-exceeded",
    "description": "capacity is exceeded: the events would take the store beyond the number of events its license permits",
    "details": {}
  }
}
```
