{"record":{"id":"7bf0c04771d2b103","repo":"cilium/cilium","slug":"unsupported-type-t","errorCode":null,"errorMessage":"unsupported type %T","messagePattern":"unsupported type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/dpgen/config.go","lineNumber":269,"sourceCode":"\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"unsupported unsigned integer size %d\", t.Size)\n\t\t\t}\n\t\tcase btf.Bool:\n\t\t\treturn getValue[bool](v)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported encoding %v\", t.Encoding)\n\t\t}\n\n\tcase *btf.Union:\n\t\tneedUtils = true\n\t\treturn getCastValue(t.Name, t.Size, v, typesPkg)\n\n\tcase *btf.Struct:\n\t\tneedUtils = true\n\t\treturn getCastValue(t.Name, t.Size, v, typesPkg)\n\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported type %T\", t)\n\t}\n}\n\nfunc getValue[T comparable](v *ebpf.VariableSpec) (out T, err error) {\n\tif err := v.Get(&out); err != nil {\n\t\treturn out, fmt.Errorf(\"getting value: %w\", err)\n\t}\n\treturn out, nil\n}\n\n// getCastValue gets the default value of a variable and returns a string of Go\n// code that casts the value to the appropriate Go type using the cast() helper\n// provided by util_generated.go.\n//\n//\tcast[uint32]([]byte{0x01, 0x00, 0x00, 0x00}\nfunc getCastValue(name string, size uint32, v *ebpf.VariableSpec, typesPkg string) (string, error) {\n\tb := make([]byte, size)\n\tif err := v.Get(b); err != nil {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/tools/dpgen/config.go#L251-L287","documentation":"varGoValue handles only *btf.Int, *btf.Enum, *btf.Union and *btf.Struct kinds when synthesizing a default Go literal. Any other underlying type (pointer, array, function, etc.) cannot get a default value, so it fails naming the concrete Go type via %T.","triggerScenarios":"Declaring a config variable whose underlying BTF type is not an int/enum/struct/union — e.g. const char *name or int arr[16] — and running dpgen.","commonSituations":"Developers adding pointers or arrays to the bpf config map and regenerating, expecting dpgen to cope.","solutions":["Change the variable to a supported scalar (sized int, bool, enum) or a struct/union.","Move non-scalar data into a named struct (generate it with `dpgen type`) and reference that.","Read the %T in the message to identify the offending kind.","Add a case to varGoValue if the kind must be supported."],"exampleFix":"// before\nconst char *name;\n// after\nstruct config { char name[64]; }; // use struct in config","handlingStrategy":"type-guard","validationCode":"switch btf.UnderlyingType(v.Type).(type) {\ncase *btf.Int, *btf.Enum, *btf.Struct, *btf.Union:\n    // ok\ndefault:\n    return fmt.Errorf(\"%s: kind has no default Go value\", v.Name)\n}","typeGuard":"func supportsGoValue(t btf.Type) bool {\n    switch btf.UnderlyingType(t).(type) {\n    case *btf.Int, *btf.Enum, *btf.Struct, *btf.Union:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":null,"preventionTips":["Never put pointers, arrays or function types in the config section.","Model composite data as named structs regenerated via `dpgen type`.","Run the kind guard in CI before invoking dpgen.","Identify the offending kind from the %T message."],"tags":["btf","type-system","codegen"],"backgroundTag":"btf-codegen-unsupported-type","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}