temporalio/temporal · error

not supported batch type: %v

Error message

not supported batch type: %v

What it means

ValidateBatchOperation runs a switch over params.GetOperation() and validates the per-type filter (Terminate, Cancel, Signal, Reset, etc.). If the operation enum value is not one of the supported batch operation types, the default branch returns this error, meaning the requested batch operation cannot be validated or executed by the batcher.

Source

Thrown at service/worker/batcher/workflow.go:334

			return serviceerror.NewInvalidArgument("cannot set both activity options and restore original")
		}
		if op.UpdateActivityOptionsOperation.GetActivityOptions() == nil && !op.UpdateActivityOptionsOperation.GetRestoreOriginal() {
			return serviceerror.NewInvalidArgument("Either activity type must be set, or restore original should be set to true")
		}

		switch a := op.UpdateActivityOptionsOperation.GetActivity().(type) {
		case *batchpb.BatchOperationUpdateActivityOptions_Type:
			if len(a.Type) == 0 {
				return serviceerror.NewInvalidArgument("Either activity type must be set, or match all should be set to true")
			}
		case *batchpb.BatchOperationUpdateActivityOptions_MatchAll:
			if !a.MatchAll {
				return serviceerror.NewInvalidArgument("Either activity type must be set, or match all should be set to true")
			}
		}
		return nil
	default:
		return fmt.Errorf("not supported batch type: %v", params.GetOperation())
	}
	return nil
}

func setDefaultParams(params *batchspb.BatchOperationInput) *batchspb.BatchOperationInput {
	if params.GetAttemptsOnRetryableError() <= 1 {
		params.AttemptsOnRetryableError = defaultAttemptsOnRetryableError
	}
	if params.GetActivityHeartbeatTimeout().AsDuration() <= 0 {
		params.ActivityHeartbeatTimeout = &durationpb.Duration{
			Seconds: int64(defaultActivityHeartBeatTimeout / time.Second),
		}
	}
	return params
}

View on GitHub (pinned to bde624efd1)

Solutions

  1. Set a supported Operation oneof in the batch request (e.g. batch_operation_termination, batch_operation_cancel, batch_operation_signal).
  2. Check the error's %v value against the BatchOperationType enum to see what was passed; fix the caller to send a valid enum value.
  3. Align client SDK/proto version with the server version so newly added batch types are understood.
  4. If you need an unsupported operation, upgrade the server or use an alternative path (per-workflow terminate/cancel via CLI).

Example fix

// before
req := &workflowservice.StartBatchOperationRequest{
  Operation: &workflowservice.StartBatchOperationRequest_BatchOperationReset{}, // unsupported here
}
// after
req := &workflowservice.StartBatchOperationRequest{
  Operation: &workflowservice.StartBatchOperationRequest_BatchOperationTermination{
    BatchOperationTermination: &batch.BatchOperationTermination{Identity: "batch-agent"},
  },
}
Defensive patterns

Strategy: validation

Validate before calling

switch params.GetOperation().(type) {
case *batch.BatchOperation_Termination, *batch.BatchOperation_Cancel,
     *batch.BatchOperation_Signal, *batch.BatchOperation_Reset:
  // ok
default:
  return fmt.Errorf("unsupported or unset batch operation: %v", params.GetOperation())
}

Type guard

func isSupportedBatchOp(op *batch.BatchOperation) bool {
  switch op.GetOperation().(type) {
  case *batch.BatchOperation_Termination, *batch.BatchOperation_Cancel,
       *batch.BatchOperation_Signal, *batch.BatchOperation_Reset:
    return true
  }
  return false
}

Try / catch

_, err := client.StartBatchOperation(ctx, req)
if err != nil {
  if strings.Contains(err.Error(), "not supported batch type") {
    logger.Error("batch op unsupported by server; upgrade server or use supported type", tag.Error(err))
    return
  }
  return err
}

Prevention

When it happens

Trigger: Calling StartBatchOperation with a BatchOperation spec whose Operation oneof is unset or holds an operation type this server version does not support (e.g. SPECIFIED_TYPE_UNSPECIFIED, or a newer op type sent to an older server).

Common situations: Clients built against a newer proto than the deployed server sending newer batch operation types; forgetting to set the Operation oneof in the BatchOperationRequest; tooling constructing BatchOperationInput programmatically with a zero-valued operation enum.

Related errors


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