temporalio / temporalio/temporal

NewDataBlob silently swallows encoding type errors instead of returning them to callers

Open
#10,522 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.