temporalio/temporal · error

missing RespondWorkflowTaskCompletedRequest return

Error message

missing RespondWorkflowTaskCompletedRequest return

What it means

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.

Source

Thrown at common/testing/taskpoller/taskpoller.go:218

	}

	resp, err := p.respondNexusTaskCompleted(ctx, opts, task, reply)
	if err != nil {
		return nil, err
	}

	return resp, nil
}

func (p *nexusTaskPoller) respondNexusTaskCompleted(
	ctx context.Context,
	opts *options,
	task *workflowservice.PollNexusTaskQueueResponse,
	reply *workflowservice.RespondNexusTaskCompletedRequest,
) (*workflowservice.RespondNexusTaskCompletedResponse, error) {
	p.t.Helper()
	if reply == nil {
		return nil, errors.New("missing RespondWorkflowTaskCompletedRequest return")
	}
	if reply.Namespace == "" {
		reply.Namespace = p.namespace
	}
	if len(reply.TaskToken) == 0 {
		reply.TaskToken = task.TaskToken
	}
	if reply.Identity == "" {
		reply.Identity = opts.tv.WorkerIdentity()
	}
	reply.Response = &nexuspb.Response{}

	return p.client.RespondNexusTaskCompleted(ctx, reply)
}

func (p *nexusTaskPoller) respondNexusTaskFailed(
	ctx context.Context,
	opts *options,

View on GitHub (pinned to bde624efd1)

Solutions

  1. Return a non-nil &workflowservice.RespondNexusTaskCompletedRequest{} from the test's reply construction (namespace/task token are auto-filled by the poller)
  2. Check the test callback signature: it must always return an initialized request even on failure paths (use the request's Error field for failures)
  3. If nil is intentional to signal an error, return that error from the callback instead of a nil request

Example fix

// before
return nil, nil
// after
return &workflowservice.RespondNexusTaskCompletedRequest{}, nil
Defensive patterns

Strategy: validation

Validate before calling

if reply == nil {
    reply = &workflowservice.RespondNexusTaskCompletedRequest{}
}

Try / catch

resp, err := poller.HandleTask(ctx, opts, task, buildReply)
require.ErrorContains(t, err, "missing RespondWorkflowTaskCompletedRequest")

Prevention

When it happens

Trigger: Calling poller.HandleTask (via handleTask) for a nexus task where the reply callback returns nil for *workflowservice.RespondNexusTaskCompletedRequest.

Common situations: 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.

Related errors


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