# import-ahead-of-clock

An event of the import lies **more than an hour beyond the clock** of the server.

- **Route:** `import-events`
- **Description:** `import is ahead of the clock: the event in line <line> is dated <time>, more than an hour beyond the clock of the server; import it once the clock has caught up`
- **Details:** **`line`**, the number of the line in the request body that holds the event, counting from 1, and **`value`**, the time of the event in UTC, as the import stores it.

## Why It Happens

The time of an event is **never earlier than the time of the event before it**, so while the clock of the server is behind the latest event, every new event takes the **time of the latest event**, see **[Watching the Clock](/docs/eventsourcingdb/logging-and-monitoring#watching-the-clock)**. An imported event dated far in the future, such as `9999-12-31`, would give its time to **every event written after the import**, until the clock had caught up with it. So an **[import](/docs/eventsourcingdb/api/import-events)** checks every event against the clock of the server as it reads the event, and refuses one that lies **more than an hour beyond it**, as a restore does.

An hour covers the difference between the clocks of two servers, so events from a system whose clock ran **slightly ahead** still import, and new events take the time of the latest of them until the clock has caught up. An import that fails this way removes what it has imported so far, so the database holds no events again, and keeps the schemas that were registered before it.

## How to Fix It

Check the clock of the server and the time that `value` names. If the clock is behind, correct it, and import the events again. If the time of the event is wrong, correct it in the line that `line` names. Otherwise, **import the same events once the clock has caught up**, as the description says; until then, resending the request fails the same way.

## Example

For an import whose fifth line holds an event dated `9999-12-31T23:59:59.999999999Z`, 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/import-ahead-of-clock",
    "description": "import is ahead of the clock: the event in line 5 is dated 9999-12-31T23:59:59.999999999Z, more than an hour beyond the clock of the server; import it once the clock has caught up",
    "details": {
      "line": 5,
      "value": "9999-12-31T23:59:59.999999999Z"
    }
  }
}
```
