{"record":{"id":"b78e0e56a89ed50d","repo":"temporalio/temporal","slug":"missing-respondworkflowtaskcompletedrequest-return","errorCode":null,"errorMessage":"missing RespondWorkflowTaskCompletedRequest return","messagePattern":"missing RespondWorkflowTaskCompletedRequest return","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/testing/taskpoller/taskpoller.go","lineNumber":218,"sourceCode":"\t}\n\n\tresp, err := p.respondNexusTaskCompleted(ctx, opts, task, reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}\n\nfunc (p *nexusTaskPoller) respondNexusTaskCompleted(\n\tctx context.Context,\n\topts *options,\n\ttask *workflowservice.PollNexusTaskQueueResponse,\n\treply *workflowservice.RespondNexusTaskCompletedRequest,\n) (*workflowservice.RespondNexusTaskCompletedResponse, error) {\n\tp.t.Helper()\n\tif reply == nil {\n\t\treturn nil, errors.New(\"missing RespondWorkflowTaskCompletedRequest return\")\n\t}\n\tif reply.Namespace == \"\" {\n\t\treply.Namespace = p.namespace\n\t}\n\tif len(reply.TaskToken) == 0 {\n\t\treply.TaskToken = task.TaskToken\n\t}\n\tif reply.Identity == \"\" {\n\t\treply.Identity = opts.tv.WorkerIdentity()\n\t}\n\treply.Response = &nexuspb.Response{}\n\n\treturn p.client.RespondNexusTaskCompleted(ctx, reply)\n}\n\nfunc (p *nexusTaskPoller) respondNexusTaskFailed(\n\tctx context.Context,\n\topts *options,","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/testing/taskpoller/taskpoller.go#L200-L236","documentation":"TaskPoller.respondNexusTaskCompleted requires a non-nil RespondNexusTaskCompletedRequest to send to the server. The test helper guards against nil inputs because a nil reply indicates the test author forgot to build the response, and calling further into the helper would nil-pointer panic. The (misleading) message text is reused from the workflow-task variant.","triggerScenarios":"Calling poller.HandleTask (via handleTask) for a nexus task where the reply callback returns nil for *workflowservice.RespondNexusTaskCompletedRequest.","commonSituations":"Test code has a branch that returns nil, nil instead of constructing a RespondNexusTaskCompletedRequest; refactoring moved response construction away and left a nil return path.","solutions":["Return a non-nil &workflowservice.RespondNexusTaskCompletedRequest{} from the test's reply construction (namespace/task token are auto-filled by the poller)","Check the test callback signature: it must always return an initialized request even on failure paths (use the request's Error field for failures)","If nil is intentional to signal an error, return that error from the callback instead of a nil request"],"exampleFix":"// before\nreturn nil, nil\n// after\nreturn &workflowservice.RespondNexusTaskCompletedRequest{}, nil","handlingStrategy":"validation","validationCode":"if reply == nil {\n    reply = &workflowservice.RespondNexusTaskCompletedRequest{}\n}","typeGuard":null,"tryCatchPattern":"resp, err := poller.HandleTask(ctx, opts, task, buildReply)\nrequire.ErrorContains(t, err, \"missing RespondWorkflowTaskCompletedRequest\")","preventionTips":["Always construct the respond request before invoking poller helpers","Use failure fields on the request instead of nil returns for error cases","Add require.NotNil on the reply in test helper callbacks"],"tags":["testing","taskpoller","nil-argument"],"backgroundTag":"nil-request-in-test-poller","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}