{"record":{"id":"fd1fafc87a3d340a","repo":"temporalio/temporal","slug":"expected-v-but-got-v","errorCode":null,"errorMessage":"expected > %v but got %v","messagePattern":"expected > (.+?) but got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/api/get_history_util.go","lineNumber":484,"sourceCode":"\tpageSize int,\n) error {\n\n\tif eventCount == 0 {\n\t\tif isLastPage {\n\t\t\t// we seem to be returning a non-nil pageToken on the lastPage which\n\t\t\t// in turn cases the client to call getHistory again - only to find\n\t\t\t// there are no more events to consume - bail out if this is the case here\n\t\t\treturn nil\n\t\t}\n\t\treturn softassert.UnexpectedDataLoss(logger, \"History contains zero events\", nil)\n\t}\n\n\tif !isFirstPage { // at least one page of history has been read previously\n\t\tif firstEvent.GetEventId() <= expectedFirstEventID {\n\t\t\t// not first page and no events have been read in the previous pages - not possible\n\t\t\treturn softassert.UnexpectedDataLoss(logger,\n\t\t\t\t\"Invalid history: expected first eventID to be greater than last seen\",\n\t\t\t\tfmt.Errorf(\"expected > %v but got %v\", expectedFirstEventID, firstEvent.GetEventId()))\n\t\t}\n\t\texpectedFirstEventID = firstEvent.GetEventId()\n\t}\n\n\tif !isLastPage {\n\t\t// estimate lastEventID based on pageSize. This is a lower bound\n\t\t// since the persistence layer counts \"batch of events\" as a single page\n\t\texpectedLastEventID = expectedFirstEventID + int64(pageSize) - 1\n\t}\n\n\tnExpectedEvents := expectedLastEventID - expectedFirstEventID + 1\n\n\tif firstEvent.GetEventId() == expectedFirstEventID &&\n\t\t((isLastPage && lastEvent.GetEventId() == expectedLastEventID && int64(eventCount) == nExpectedEvents) ||\n\t\t\t(!isLastPage && lastEvent.GetEventId() >= expectedLastEventID && int64(eventCount) >= nExpectedEvents)) {\n\t\treturn nil\n\t}\n","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/api/get_history_util.go#L466-L502","documentation":"Error \"expected > %v but got %v\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at service/history/api/get_history_util.go:484 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}