temporalio / temporalio/temporal
NewDataBlob silently swallows encoding type errors instead of returning them to callers
Open
@yycptt is already working on this.
Since Jun 11, 2026.
- Dominant language
- Go
- Stars
- 23.2k
- Forks
- 1.9k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 228
Description
Summary
NewDataBlob in data_blob.go silently ignores invalid
encoding type strings by setting ENCODING_TYPE_UNSPECIFIED
instead of surfacing the error to callers.
Root Cause
func NewDataBlob(data []byte, encodingTypeStr string) *commonpb.DataBlob {
encodingType, err := enumspb.EncodingTypeFromString(encodingTypeStr)
if err != nil {
// TODO: return an UnknownEncodingType error
encodingType = enumspb.ENCODING_TYPE_UNSPECIFIED // silent failure
}
return &commonpb.DataBlob{...}
}
Impact
- Invalid encoding type strings fail silently
- Error only surfaces later during deserialization
- Harder to diagnose root cause of encoding failures
- No signal to caller that something went wrong at creation time
Suggested Fix
Change function signature to return (*commonpb.DataBlob, error)
and return error when encoding type is invalid. Alternatively,
add a separate NewDataBlobWithError variant that callers can
use when they need error handling.
Question for team
Should this be a signature change (breaking) or a new function
variant? How many callers need updating?
References
common/persistence/data_blob.go:9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.