apache/beam · error
type value must be a concrete type
Error message
type value %s must be a concrete type
What it means
makeTypedefs requires each TypeDefinition's T to be a concrete Go type (typex.CheckConcrete). Generic or universe types cannot be used as the bound value of a type variable, so registration fails with this wrapped error.
Solutions
- Set T to a concrete reflect.Type, e.g. reflect.TypeOf(int64(0)).
- Swap fields if Var and T were reversed — Var gets typex.NewVariable, T gets the concrete type.
- Check the wrapped error from typex.CheckConcrete for which part of T is non-concrete.
Example fix
// before
beam.TypeDefinition{Var: typex.NewVariable("X"), T: typex.NewVariable("Y")}
// after
beam.TypeDefinition{Var: typex.NewVariable("X"), T: reflect.TypeOf((*string)(nil)).Elem()} Defensive patterns
Strategy: validation
Validate before calling
if ok, err := typex.CheckConcrete(td.T); !ok {
return fmt.Errorf("TypeDefinition.T must be a concrete reflect.Type: %v", err)
} Type guard
func concreteTypedef(td beam.TypeDefinition) bool {
ok, _ := typex.CheckConcrete(td.T)
return typex.IsUniversal(td.Var) && ok
} Try / catch
if err := beam.TryParDo(s, fn, col, opts...); err != nil {
return fmt.Errorf("ParDo rejected: %w", err)
} Prevention
- Set T to reflect.TypeOf(value) of a real Go type.
- Never pass typex.NewVariable or universe types as T.
- Double-check field order when constructing beam.TypeDefinition.
When it happens
Trigger: Passing a TypeDefinition whose T is a non-concrete typex.T (e.g. typex.NewVariable, typex.Universal, or another abstract type) while calling TryParDo/TryCombinePerKey with type definitions.
Common situations: Swapping the Var and T fields by mistake; using typex.New(var) where a concrete reflect.Type is required; translating Scala/Java generics-style defaults into Go incorrectly.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- type var must be a universal type
- bad output type
- Compression factor should be greater than 0.
- Delimiter must be a non-empty bytes sequence.
- Delimiter must not self-overlap.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6295114df491875b.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/validate.go:75
if !in.Input.IsValid() {
return nil, nil, errors.Errorf("invalid side pcollection: index %v", i)
}
}
typedefs, err := makeTypedefs(defs)
if err != nil {
return nil, nil, err
}
return side, typedefs, nil
}
func makeTypedefs(list []TypeDefinition) (map[string]reflect.Type, error) {
typedefs := make(map[string]reflect.Type)
for _, v := range list {
if !typex.IsUniversal(v.Var) {
return nil, errors.Errorf("type var %s must be a universal type", v.Var)
}
if ok, err := typex.CheckConcrete(v.T); !ok {
return nil, errors.Wrapf(err, "type value %s must be a concrete type", v.T)
}
typedefs[v.Var.Name()] = v.T
}
return typedefs, nil
}
View on GitHub (pinned to 12126d8942)