{"record":{"id":"d4ef3014a443b252","repo":"temporalio/temporal","slug":"batch-operation-stats-are-not-present-in-the-memo","errorCode":null,"errorMessage":"batch operation stats are not present in the memo","messagePattern":"batch operation stats are not present in the memo","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"service/frontend/workflow_handler.go","lineNumber":6305,"sourceCode":"\t\tif len(resp.GetPendingActivities()) > 0 {\n\t\t\thbdPayload := resp.GetPendingActivities()[0].HeartbeatDetails\n\t\t\tvar hbd batcher.HeartBeatDetails\n\t\t\terr = payloads.Decode(hbdPayload, &hbd)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbatchOperationResp.TotalOperationCount = hbd.TotalEstimate\n\t\t\tbatchOperationResp.CompleteOperationCount = int64(hbd.SuccessCount)\n\t\t\tbatchOperationResp.FailureOperationCount = int64(hbd.ErrorCount)\n\t\t}\n\t}\n\treturn batchOperationResp, nil\n}\n\nfunc (wh *WorkflowHandler) getCompletedBatchOperationStats(memo map[string]*commonpb.Payload) (stats batcher.BatchOperationStats, err error) {\n\tstatsPayload, ok := memo[batcher.BatchOperationStatsMemo]\n\tif !ok {\n\t\treturn stats, errors.New(\"batch operation stats are not present in the memo\")\n\t}\n\terr = payload.Decode(statsPayload, &stats)\n\treturn stats, err\n}\n\nfunc (wh *WorkflowHandler) ListBatchOperations(\n\tctx context.Context,\n\trequest *workflowservice.ListBatchOperationsRequest,\n) (_ *workflowservice.ListBatchOperationsResponse, retError error) {\n\tdefer log.CapturePanic(wh.logger, &retError)\n\n\tif err := wh.versionChecker.ClientSupported(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif request == nil {\n\t\treturn nil, errRequestNotSet\n\t}","sourceCodeStart":6287,"sourceCodeEnd":6323,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/frontend/workflow_handler.go#L6287-L6323","documentation":"Returned by WorkflowHandler.getCompletedBatchOperationStats when the batch operation's stats payload is missing from the workflow memo. Completed batch operations record BatchOperationStats in the workflow's memo; if absent, the handler cannot decode and return stats for ListBatchOperations/DescribeBatchOperation responses.","triggerScenarios":"Calling ListBatchOperations/DescribeBatchOperation on a completed batch workflow whose memo lacks the 'batch-operation-stats' key - typically a batch workflow started by an older server version or one whose memo was overwritten.","commonSituations":"Clusters upgraded from versions before stats were stored in memo, batch workflows started with overridden/patched memo, or manual memo edits via UpdateWorkflow.","solutions":["Upgrade to a server version that writes batch operation stats to the memo and re-run the batch operation if stats are required","Handle the error gracefully in tooling: show batch result status without stats for legacy batch workflows","Do not modify batch workflow memo via UpdateWorkflow while a batch is running"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// caller-side check before decoding stats\nif _, ok := memo[batcher.BatchOperationStatsMemo]; !ok { // skip stats in the response }","typeGuard":"func statsInMemo(memo map[string]*commonpb.Payload) bool {\n  _, ok := memo[batcher.BatchOperationStatsMemo]\n  return ok\n}","tryCatchPattern":"stats, err := wh.getCompletedBatchOperationStats(memo)\nif err != nil { stats = batcher.BatchOperationStats{} /* respond without stats */ }","preventionTips":["Run a server version that writes batch stats into the workflow memo","Don't overwrite batch workflow memo via UpdateWorkflow","Handle legacy batch workflows gracefully in operational tooling"],"tags":["batch","memo","admin-api","temporal-server"],"backgroundTag":"missing-memo-payload","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}