temporalio/temporal · error

UpsertWorkflowExecution unexpected numRows (%v) updates

Error message

UpsertWorkflowExecution unexpected numRows (%v) updates

What it means

Error "UpsertWorkflowExecution unexpected numRows (%v) updates" thrown in temporalio/temporal.

Source

Thrown at common/persistence/visibility/store/sql/visibility_store.go:177

func (s *VisibilityStore) UpsertWorkflowExecution(
	ctx context.Context,
	request *store.InternalUpsertWorkflowExecutionRequest,
) error {
	row, err := s.generateVisibilityRow(request.InternalVisibilityRequestBase)
	if err != nil {
		return err
	}

	result, err := s.sqlStore.DB.ReplaceIntoVisibility(ctx, row)
	if err != nil {
		return err
	}
	noRowsAffected, err := result.RowsAffected()
	if err != nil {
		return err
	}
	if noRowsAffected > 2 { // either adds a new or deletes old row and adds new row
		return fmt.Errorf("UpsertWorkflowExecution unexpected numRows (%v) updates", noRowsAffected)
	}
	return nil
}

func (s *VisibilityStore) DeleteWorkflowExecution(
	ctx context.Context,
	request *manager.VisibilityDeleteWorkflowExecutionRequest,
) error {
	_, err := s.sqlStore.DB.DeleteFromVisibility(ctx, sqlplugin.VisibilityDeleteFilter{
		NamespaceID: request.NamespaceID.String(),
		RunID:       request.RunID,
	})
	if err != nil {
		return convertSQLError("DeleteWorkflowExecution operation failed.", err)
	}
	return nil
}

View on GitHub (pinned to bde624efd1)

When it happens

Trigger: Thrown at common/persistence/visibility/store/sql/visibility_store.go:177 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/d9c230ea5bd67308. Report an issue: GitHub.