{"record":{"id":"58147be85c52427a","repo":"temporalio/temporal","slug":"not-supported-batch-type-v","errorCode":null,"errorMessage":"not supported batch type: %v","messagePattern":"not supported batch type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/worker/batcher/workflow.go","lineNumber":334,"sourceCode":"\t\t\treturn serviceerror.NewInvalidArgument(\"cannot set both activity options and restore original\")\n\t\t}\n\t\tif op.UpdateActivityOptionsOperation.GetActivityOptions() == nil && !op.UpdateActivityOptionsOperation.GetRestoreOriginal() {\n\t\t\treturn serviceerror.NewInvalidArgument(\"Either activity type must be set, or restore original should be set to true\")\n\t\t}\n\n\t\tswitch a := op.UpdateActivityOptionsOperation.GetActivity().(type) {\n\t\tcase *batchpb.BatchOperationUpdateActivityOptions_Type:\n\t\t\tif len(a.Type) == 0 {\n\t\t\t\treturn serviceerror.NewInvalidArgument(\"Either activity type must be set, or match all should be set to true\")\n\t\t\t}\n\t\tcase *batchpb.BatchOperationUpdateActivityOptions_MatchAll:\n\t\t\tif !a.MatchAll {\n\t\t\t\treturn serviceerror.NewInvalidArgument(\"Either activity type must be set, or match all should be set to true\")\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"not supported batch type: %v\", params.GetOperation())\n\t}\n\treturn nil\n}\n\nfunc setDefaultParams(params *batchspb.BatchOperationInput) *batchspb.BatchOperationInput {\n\tif params.GetAttemptsOnRetryableError() <= 1 {\n\t\tparams.AttemptsOnRetryableError = defaultAttemptsOnRetryableError\n\t}\n\tif params.GetActivityHeartbeatTimeout().AsDuration() <= 0 {\n\t\tparams.ActivityHeartbeatTimeout = &durationpb.Duration{\n\t\t\tSeconds: int64(defaultActivityHeartBeatTimeout / time.Second),\n\t\t}\n\t}\n\treturn params\n}\n","sourceCodeStart":316,"sourceCodeEnd":350,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/batcher/workflow.go#L316-L350","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set a supported Operation oneof in the batch request (e.g. batch_operation_termination, batch_operation_cancel, batch_operation_signal).","Check the error's %v value against the BatchOperationType enum to see what was passed; fix the caller to send a valid enum value.","Align client SDK/proto version with the server version so newly added batch types are understood.","If you need an unsupported operation, upgrade the server or use an alternative path (per-workflow terminate/cancel via CLI)."],"exampleFix":"// before\nreq := &workflowservice.StartBatchOperationRequest{\n  Operation: &workflowservice.StartBatchOperationRequest_BatchOperationReset{}, // unsupported here\n}\n// after\nreq := &workflowservice.StartBatchOperationRequest{\n  Operation: &workflowservice.StartBatchOperationRequest_BatchOperationTermination{\n    BatchOperationTermination: &batch.BatchOperationTermination{Identity: \"batch-agent\"},\n  },\n}","handlingStrategy":"validation","validationCode":"switch params.GetOperation().(type) {\ncase *batch.BatchOperation_Termination, *batch.BatchOperation_Cancel,\n     *batch.BatchOperation_Signal, *batch.BatchOperation_Reset:\n  // ok\ndefault:\n  return fmt.Errorf(\"unsupported or unset batch operation: %v\", params.GetOperation())\n}","typeGuard":"func isSupportedBatchOp(op *batch.BatchOperation) bool {\n  switch op.GetOperation().(type) {\n  case *batch.BatchOperation_Termination, *batch.BatchOperation_Cancel,\n       *batch.BatchOperation_Signal, *batch.BatchOperation_Reset:\n    return true\n  }\n  return false\n}","tryCatchPattern":"_, err := client.StartBatchOperation(ctx, req)\nif err != nil {\n  if strings.Contains(err.Error(), \"not supported batch type\") {\n    logger.Error(\"batch op unsupported by server; upgrade server or use supported type\", tag.Error(err))\n    return\n  }\n  return err\n}","preventionTips":["Always populate exactly one Operation oneof in batch requests.","Keep client SDK/proto versions aligned with the server's supported batch types.","Validate the operation enum server-side-agnostically before submitting.","Use the official CLI/SDK helpers to build batch requests instead of hand-assembling protos."],"tags":["go","batch","validation","unsupported-operation"],"backgroundTag":"unsupported-batch-operation-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}