{"record":{"id":"6295114df491875b","repo":"apache/beam","slug":"type-value-s-must-be-a-concrete-type","errorCode":null,"errorMessage":"type value %s must be a concrete type","messagePattern":"type value (.+?) must be a concrete type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/validate.go","lineNumber":75,"sourceCode":"\t\tif !in.Input.IsValid() {\n\t\t\treturn nil, nil, errors.Errorf(\"invalid side pcollection: index %v\", i)\n\t\t}\n\t}\n\ttypedefs, err := makeTypedefs(defs)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn side, typedefs, nil\n}\n\nfunc makeTypedefs(list []TypeDefinition) (map[string]reflect.Type, error) {\n\ttypedefs := make(map[string]reflect.Type)\n\tfor _, v := range list {\n\t\tif !typex.IsUniversal(v.Var) {\n\t\t\treturn nil, errors.Errorf(\"type var %s must be a universal type\", v.Var)\n\t\t}\n\t\tif ok, err := typex.CheckConcrete(v.T); !ok {\n\t\t\treturn nil, errors.Wrapf(err, \"type value %s must be a concrete type\", v.T)\n\t\t}\n\t\ttypedefs[v.Var.Name()] = v.T\n\t}\n\treturn typedefs, nil\n}\n","sourceCodeStart":57,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/validate.go#L57-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nbeam.TypeDefinition{Var: typex.NewVariable(\"X\"), T: typex.NewVariable(\"Y\")}\n// after\nbeam.TypeDefinition{Var: typex.NewVariable(\"X\"), T: reflect.TypeOf((*string)(nil)).Elem()}","handlingStrategy":"validation","validationCode":"if ok, err := typex.CheckConcrete(td.T); !ok {\n    return fmt.Errorf(\"TypeDefinition.T must be a concrete reflect.Type: %v\", err)\n}","typeGuard":"func concreteTypedef(td beam.TypeDefinition) bool {\n    ok, _ := typex.CheckConcrete(td.T)\n    return typex.IsUniversal(td.Var) && ok\n}","tryCatchPattern":"if err := beam.TryParDo(s, fn, col, opts...); err != nil {\n    return fmt.Errorf(\"ParDo rejected: %w\", err)\n}","preventionTips":["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."],"tags":["beam","types","validation"],"backgroundTag":"type-mismatch","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}