Docs / SynthEvents / Errors / range-too-long

range-too-long

The time range is too long for the number of events.

  • Status: 422 Unprocessable Entity
  • Route: POST /api/v1/generate-events
  • Description: range is too long for the event count: expected a shorter range or more events
  • Details: eventCount, from, and to, as the request gave them.

Why It Happens#

Even the smallest population, such as a single reader or customer, comes out at too many events in this range: over so long a range, one actor alone does more than was asked for. A single reader of the library, for example, borrows dozens of books over ten years, so asking for 5 events of the library over ten years is refused this way.

The to-dos count their population in weeks of a user, so for them, the length of the range does not matter from a week on: a single week of a user can already come out at more than one or two events, and asking for so few is now and then refused, however long the range. Asking for a few more events helps.

How to Fix It#

Make the range shorter, or ask for more events. For how SynthEvents sizes a run, see The Number of Events.

Example#

For 5 events of the library over ten years, SynthEvents answers:

{
  "type": "error",
  "data": {
    "code": "https://docs.synthevents.io/errors/range-too-long",
    "description": "range is too long for the event count: expected a shorter range or more events",
    "details": {
      "eventCount": 5,
      "from": "2015-01-01T00:00:00Z",
      "to": "2025-01-01T00:00:00Z"
    }
  }
}