{"record":{"id":"b91019af9d4028bd","repo":"cilium/cilium","slug":"unsupported-encoding-v","errorCode":null,"errorMessage":"unsupported encoding %v","messagePattern":"unsupported encoding (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/dpgen/config.go","lineNumber":257,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"unsupported signed integer size %d\", t.Size)\n\t\t\t}\n\t\tcase btf.Unsigned:\n\t\t\tswitch t.Size {\n\t\t\tcase 1:\n\t\t\t\treturn getValue[uint8](v)\n\t\t\tcase 2:\n\t\t\t\treturn getValue[uint16](v)\n\t\t\tcase 4:\n\t\t\t\treturn getValue[uint32](v)\n\t\t\tcase 8:\n\t\t\t\treturn getValue[uint64](v)\n\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)","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/tools/dpgen/config.go#L239-L275","documentation":"For btf.Integer, varGoValue only recognizes Signed, Unsigned and Bool encodings. Any other Encoding value (e.g. character or bitfield-flavored encodings from certain toolchains) has no mapping, so the generator refuses to emit a default.","triggerScenarios":"A config variable whose BTF integer type reports an Encoding other than Signed/Unsigned/Bool while varGoValue runs.","commonSituations":"Plain 'char' whose encoding resolves oddly across clang versions, or objects built by a compiler emitting encodings the generator doesn't anticipate.","solutions":["Replace the type with an explicitly signed/unsigned type or bool so the encoding is one of the three supported.","Rebuild with a supported clang/LLVM version with -g.","Inspect the actual Encoding via bpftool btf dump.","Extend the encoding switch in varGoValue if needed."],"exampleFix":"// before (ambiguous encoding)\nchar mode;\n// after\nsigned char mode; // or unsigned char / bool","handlingStrategy":"validation","validationCode":"if t, ok := btf.UnderlyingType(v.Type).(*btf.Int); ok {\n    switch t.Encoding {\n    case btf.Signed, btf.Unsigned, btf.Bool:\n    default:\n        return fmt.Errorf(\"%s: encoding %v unsupported\", v.Name, t.Encoding)\n    }\n}","typeGuard":"func hasSupportedIntEncoding(t btf.Type) bool {\n    i, ok := btf.UnderlyingType(t).(*btf.Int)\n    if !ok {\n        return false\n    }\n    return i.Encoding == btf.Signed || i.Encoding == btf.Unsigned || i.Encoding == btf.Bool\n}","tryCatchPattern":null,"preventionTips":["Prefer explicitly signed/unsigned types over plain char.","Use stdbool.h bool for flags so the encoding is btf.Bool.","Keep the clang/LLVM version consistent with what dpgen supports.","Inspect encodings via bpftool btf dump when in doubt."],"tags":["btf","encoding","codegen"],"backgroundTag":"btf-unsupported-encoding","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}