Skip to content

[Bug]: Go SDK registration panics on anonymous structs. #21789

Closed

Description

@youngoli

What happened?

Using register.Function (and presumable any other registration function) on an anonymous struct causes a panic immediately. This happens because anonymous types are unregisterable, but the problem is that with generic registration, types are registered from these function signatures, which means any functions with anonymous parameters can't be registered at all, and therefore any types that only appear in the function signature are in effect unregisterable.

The preference here would be for unregisterable parameters to simply be skipped, and for registration to fail gracefully. That is, register everything that can be registered and skip everything that can't (ideally with warnings explaining what isn't being registered).

Example abbreviated stacktrace:

panic: invalid registration type: struct { Counter *int64 "beam:\"counter\""; Rand_data *struct { Flip *bool "beam:\"flip\""; Num *int64 "beam:\"num\""; Word *string "beam:\"word\"" } "beam:\"rand_data\"" }

goroutine 1 [running]:
github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime.RegisterType({0x118ecb8?, 0xe7df60?})
    {...}/beam/sdks/go/pkg/beam/core/runtime/types.go:39 +0x24e
github.com/apache/beam/sdks/v2/go/pkg/beam/register.registerMethodTypes({0x118ecb8, 0xda8280})
    {...}/beam/sdks/go/pkg/beam/register/register.go:8487 +0xba
github.com/apache/beam/sdks/v2/go/pkg/beam/register.Function1x1[...](0x104db10?)
    {...}/beam/sdks/go/pkg/beam/register/register.go:3258 +0xc5

Issue Priority

Priority: 2

Issue Component

Component: sdk-go

Activity

  1. Thanatos9404 commented on Oct 18, 2026

    @Thanatos9404
    Contributor

    .take-issue

  2. added 2 commits that reference this issue on Oct 21, 2026
    7241c9b
    ea83047
  3. added a commit that references this issue on Oct 26, 2026
    927c5b2
  4. added this to the 2.78.0 Release milestone on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions