{"record":{"id":"25a3bb60989d8e9d","repo":"vitessio/vitess","slug":"don-t-know-how-to-handle-type-s-t","errorCode":null,"errorMessage":"don't know how to handle type %s %T","messagePattern":"don't know how to handle type (.+?) %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/asthelpergen/asthelpergen.go","lineNumber":394,"sourceCode":"func (gen *astHelperGen) processTypeWithGenerators(t types.Type) error {\n\tunderlying := t.Underlying()\n\ttypeName := printableTypeName(t)\n\n\tfor _, g := range gen.gens {\n\t\tvar err error\n\t\tswitch underlying := underlying.(type) {\n\t\tcase *types.Interface:\n\t\t\terr = g.interfaceMethod(t, underlying, gen)\n\t\tcase *types.Slice:\n\t\t\terr = g.sliceMethod(t, underlying, gen)\n\t\tcase *types.Struct:\n\t\t\terr = g.structMethod(t, underlying, gen)\n\t\tcase *types.Pointer:\n\t\t\terr = gen.handlePointerType(t, underlying, g)\n\t\tcase *types.Basic:\n\t\t\terr = g.basicMethod(t, underlying, gen)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"don't know how to handle type %s %T\", typeName, underlying)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"generator failed for type %s: %w\", typeName, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// handlePointerType handles pointer types by dispatching to the appropriate method\nfunc (gen *astHelperGen) handlePointerType(t types.Type, ptr *types.Pointer, g generator) error {\n\tptrToType := ptr.Elem().Underlying()\n\tswitch ptrToType := ptrToType.(type) {\n\tcase *types.Struct:\n\t\treturn g.ptrToStructMethod(t, ptrToType, gen)\n\tcase *types.Basic:\n\t\treturn g.ptrToBasicMethod(t, ptrToType, gen)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported pointer type %T\", ptrToType)","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/asthelpergen/asthelpergen.go#L376-L412","documentation":"processTypeWithGenerators dispatches on the type's underlying kind (interface, struct, map, slice, pointer, basic). If the underlying type is none of the handled kinds (e.g. *types.Named reaching default, *types.Signature, *types.Chan), this error is thrown.","triggerScenarios":"A type in the work queue has an underlying kind like func or chan, or the dispatch switch is missing a case for a kind newly present in the codebase.","commonSituations":"Adding an AST node type backed by an unusual underlying type; generator switch not updated after Go/go-types changes introduce new underlying kinds.","solutions":["Add a case in processTypeWithGenerators for the offending underlying kind (see %T in the message) with an appropriate handler","If the type should not be processed, prevent it from being enqueued in processTypeQueue","File/inspect which type failed: the message includes both type name and underlying kind"],"exampleFix":"// before\ndefault:\n  return fmt.Errorf(\"don't know how to handle type %s %T\", typeName, underlying)\n// after\ncase *types.Signature:\n  err = g.signatureMethod(t, underlying, gen)","handlingStrategy":"type-guard","validationCode":"if err := checkSupportedKind(underlying); err != nil {\n    return fmt.Errorf(\"skip %s: %w\", typeName, err)\n}","typeGuard":"func supportedUnderlying(t types.Type) bool {\n    switch t.Underlying().(type) {\n    case *types.Interface, *types.Struct, *types.Map, *types.Slice, *types.Pointer, *types.Basic:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Keep AST types limited to kinds the generators already support","Add a dispatch case whenever a new underlying kind appears in the queue","The %T in the error tells you the exact kind; handle it explicitly rather than broadening default"],"tags":["codegen","type-dispatch","unsupported-type"],"backgroundTag":"unsupported-type-kind","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}