temporalio/temporal · error
GetWorkflowExecutionHistory failed
Error message
GetWorkflowExecutionHistory failed
What it means
getFirstWorkflowTaskEventID pages forward through a workflow's history via GetWorkflowExecutionHistory to locate the first WorkflowTaskCompleted event for batch reset. Any RPC failure is logged and replaced by this generic sentinel error. Like its reverse counterpart, the underlying cause is lost from the returned error and must be read from the worker logs.
Source
Thrown at service/worker/batcher/activities.go:1130
func getFirstWorkflowTaskEventID(
ctx context.Context,
namespaceStr string,
workflowExecution *commonpb.WorkflowExecution,
frontendClient workflowservice.WorkflowServiceClient,
logger log.Logger,
) (workflowTaskEventID int64, err error) {
req := &workflowservice.GetWorkflowExecutionHistoryRequest{
Namespace: namespaceStr,
Execution: workflowExecution,
MaximumPageSize: 1000,
NextPageToken: nil,
}
for {
resp, err := frontendClient.GetWorkflowExecutionHistory(ctx, req)
if err != nil {
logger.Error("failed to run GetWorkflowExecutionHistory", tag.Error(err))
return 0, errors.New("GetWorkflowExecutionHistory failed")
}
for _, e := range resp.GetHistory().GetEvents() {
switch e.GetEventType() {
case enumspb.EVENT_TYPE_WORKFLOW_TASK_COMPLETED:
workflowTaskEventID = e.GetEventId()
return workflowTaskEventID, nil
case enumspb.EVENT_TYPE_WORKFLOW_TASK_SCHEDULED:
if workflowTaskEventID == 0 {
workflowTaskEventID = e.GetEventId() + 1
}
}
}
if len(resp.NextPageToken) == 0 {
break
}
req.NextPageToken = resp.NextPageToken
}
if workflowTaskEventID == 0 {View on GitHub (pinned to bde624efd1)
Solutions
- Search worker logs for 'failed to run GetWorkflowExecutionHistory' to find the root cause.
- Confirm the workflow's history is retrievable (not archived/purged) with temporal workflow show --workflow-id ...
- Check frontend/history service health and database connectivity.
- Re-run the batch operation after restoring service health; consider paginating smaller batches to reduce load.
Example fix
// before
resp, err := frontendClient.GetWorkflowExecutionHistory(ctx, req)
if err != nil {
logger.Error("failed to run GetWorkflowExecutionHistory", tag.Error(err))
return 0, errors.New("GetWorkflowExecutionHistory failed")
}
// after
resp, err := frontendClient.GetWorkflowExecutionHistory(ctx, req)
if err != nil {
logger.Error("failed to run GetWorkflowExecutionHistory", tag.Error(err))
return 0, fmt.Errorf("GetWorkflowExecutionHistory failed: %w", err)
} Defensive patterns
Strategy: retry
Try / catch
if _, err := batcher.GetFirstWorkflowTaskEventID(...); err != nil {
if strings.Contains(err.Error(), "GetWorkflowExecutionHistory failed") {
// retry with backoff after checking history service health
}
} Prevention
- Check that target workflows' history is retrievable (not archived/deleted) before batch resets.
- Run batch jobs during low-traffic windows to reduce history RPC pressure.
- Keep batcher client configuration (frontend address, namespace) up to date.
When it happens
Trigger: Running a batch reset that needs the first workflow-task event ID while GetWorkflowExecutionHistory fails: frontend unreachable, persistence errors, nonexistent workflow/run, or unauthorized namespace access.
Common situations: Batch reset of workflows whose history has been deleted or archived; history service overload during large batch jobs; stale client connection after cluster membership change; wrong namespace in batch filter.
Related errors
- failed to get workflow execution history
- batchParams is nil
- unknown admin batch type: %T
- Reset point for %v is not resettable
- not supported batch type: %v
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/66d5128e5cfa5c79.
Report an issue: GitHub.