temporalio/temporal · error

expected > %v but got %v

Error message

expected > %v but got %v

What it means

Error "expected > %v but got %v" thrown in temporalio/temporal.

Source

Thrown at service/history/api/get_history_util.go:484

	pageSize int,
) error {

	if eventCount == 0 {
		if isLastPage {
			// we seem to be returning a non-nil pageToken on the lastPage which
			// in turn cases the client to call getHistory again - only to find
			// there are no more events to consume - bail out if this is the case here
			return nil
		}
		return softassert.UnexpectedDataLoss(logger, "History contains zero events", nil)
	}

	if !isFirstPage { // at least one page of history has been read previously
		if firstEvent.GetEventId() <= expectedFirstEventID {
			// not first page and no events have been read in the previous pages - not possible
			return softassert.UnexpectedDataLoss(logger,
				"Invalid history: expected first eventID to be greater than last seen",
				fmt.Errorf("expected > %v but got %v", expectedFirstEventID, firstEvent.GetEventId()))
		}
		expectedFirstEventID = firstEvent.GetEventId()
	}

	if !isLastPage {
		// estimate lastEventID based on pageSize. This is a lower bound
		// since the persistence layer counts "batch of events" as a single page
		expectedLastEventID = expectedFirstEventID + int64(pageSize) - 1
	}

	nExpectedEvents := expectedLastEventID - expectedFirstEventID + 1

	if firstEvent.GetEventId() == expectedFirstEventID &&
		((isLastPage && lastEvent.GetEventId() == expectedLastEventID && int64(eventCount) == nExpectedEvents) ||
			(!isLastPage && lastEvent.GetEventId() >= expectedLastEventID && int64(eventCount) >= nExpectedEvents)) {
		return nil
	}

View on GitHub (pinned to bde624efd1)

When it happens

Trigger: Thrown at service/history/api/get_history_util.go:484 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/fd1fafc87a3d340a. Report an issue: GitHub.