{"record":{"id":"6fb7492174404201","repo":"apache/beam","slug":"nil-type-at-index-v","errorCode":null,"errorMessage":"nil type at index: %v","messagePattern":"nil type at index: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/typex/fulltype.go","lineNumber":455,"sourceCode":"\t}\n}\n\nfunc substituteList(list []FullType, m map[string]reflect.Type) ([]FullType, error) {\n\tvar ret []FullType\n\tfor _, elm := range list {\n\t\trepl, err := substitute(elm, m)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tret = append(ret, repl)\n\t}\n\treturn ret, nil\n}\n\nfunc checkTypesNotNil(list []FullType) {\n\tfor i, t := range list {\n\t\tif t == nil {\n\t\t\tpanic(fmt.Sprintf(\"nil type at index: %v\", i))\n\t\t}\n\t}\n}\n\n// NoFiringPane return PaneInfo assigned as NoFiringPane(0x0f)\nfunc NoFiringPane() PaneInfo {\n\treturn PaneInfo{IsFirst: true, IsLast: true, Timing: PaneUnknown}\n}\n","sourceCodeStart":437,"sourceCodeEnd":464,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/typex/fulltype.go#L437-L464","documentation":"checkTypesNotNil is a pre-check run inside typex.New on the component list; it panics if any FullType in the list is a nil interface. This fails fast with the offending index instead of producing a corrupt type tree or a confusing nil-pointer panic later.","triggerScenarios":"Calling typex.New (or any helper that funnels into it: Prefix, CoGroupByKey, CombinePerKey, CombineGlobally, Flatten, GroupByKey) with a slice containing a nil FullType at position i, e.g. typex.New(typex.KVType, keyType, nil) or passing an uninitialized []typex.FullType element.","commonSituations":"Building component lists dynamically with append and leaving zero-value entries; failed lookups (functions returning nil FullType on error whose error return was ignored) then fed into New; struct fields of type typex.FullType never initialized.","solutions":["Inspect the reported index and fix the component list so every element is a non-nil typex.FullType before calling New.","Check errors from any type-resolution function used to build the components instead of discarding the nil result.","Pre-validate with a loop that skips/aborts on nil entries before constructing the type."],"exampleFix":"// before\ncs := []typex.FullType{keyT, valT}\ncs[1] = resolveT(name) // may return nil, error ignored\ntypex.New(typex.KVType, cs...)\n// after\nt, err := resolveT(name)\nif err != nil { return err }\ncs := []typex.FullType{keyT, t}\ntypex.New(typex.KVType, cs...)","handlingStrategy":"validation","validationCode":"func allNotNil(cs []typex.FullType) bool {\n    for _, c := range cs { if c == nil { return false } }\n    return true\n}","typeGuard":"func isNilFullType(t typex.FullType) bool { return t == nil }","tryCatchPattern":"func safeNew(t typex.Type, cs ...typex.FullType) (ft typex.FullType, err error) {\n    defer func() {\n        if r := recover(); r != nil { err = fmt.Errorf(\"typex.New: %v\", r) }\n    }()\n    return typex.New(t, cs...), nil\n}","preventionTips":["Always check the error return of type-resolution functions.","Initialize all typex.FullType struct fields before use.","Run allNotNil on dynamically built component lists before New."],"tags":["go","apache-beam","typex","panic","nil-value"],"backgroundTag":"null-argument","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"}