Skip to content

[copilot-finds] Bug: Entity executor silently loses stack traces due to protobuf setValue() return value misuse #248

@github-actions

Description

@github-actions

Problem

In packages/durabletask-js/src/worker/entity-executor.ts line 399, the entity executor's error handling uses:

failureDetails.setStacktrace(new StringValue().setValue(error.stack));

In google-protobuf, setValue() returns void (not the StringValue instance for fluent chaining). This means setStacktrace() receives undefined, silently discarding the stack trace for all entity operation failures.

Root Cause

The code assumes setValue() returns this for method chaining, but google-protobuf setters return void. This is a one-character-class-of-bug: the code compiles and runs without error, but the stack trace is never actually set on the failure details.

Proposed Fix

Construct the StringValue separately and pass it to setStacktrace(), matching the correct pattern used in pb-helper.util.ts (lines 200-202):

const stackValue = new StringValue();
stackValue.setValue(error.stack);
failureDetails.setStacktrace(stackValue);

Impact

Severity: Medium — Every entity operation failure loses its stack trace, making debugging entity errors significantly harder. Users see error type and message but cannot trace back to the exact line that threw. This affects all entity-based workflows using the V1 batch execution path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilot-findsFindings from daily automated code review agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions