# license-invalid

The **license** of the database is **not valid**, so events can no longer be written.

- **Routes:** `write-events`, `restore-backup`, and `import-events`
- **Description:** `license is invalid: it has expired, so events can no longer be written`
- **Details:** None; `details` is an empty object.

## Why It Happens

EventSourcingDB checks its license when it starts, and **does not start with a license that has expired**. So this error comes up once the license **expires while the server runs**: a commercial license at its expiration date, the evaluation license a year after the server started, and any license **48 hours after the start** at the latest if the server runs with a temporary data directory, `--data-directory-temporary`.

From then on, every write, every restore, and every import is refused, and the license is checked **before any value** of a write and before any line of a backup or of an import, since nothing can be written anyway. Reading, observing, and every other route go on as usual. The **[diagnosis](/docs/eventsourcingdb/diagnostics-and-troubleshooting)** of the server shows when its license expires, as `expiresAt`, and its `status`, which is `expired` once it has.

## How to Fix It

Restart the server with a **valid license**, given with `--license-file` or `--license-string`, as described in **[License Management](/docs/eventsourcingdb/managing-configuration-and-secrets#license-management)**. A server with a temporary data directory starts empty again, with another 48 hours. The server keeps its license while it runs, so sending the same request again fails the same way until it is restarted.

## Example

For a write after the license has expired, 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/license-invalid",
    "description": "license is invalid: it has expired, so events can no longer be written",
    "details": {}
  }
}
```
