{"record":{"id":"9651c3900a794e08","repo":"go-delve/delve","slug":"invalid-entry-tag-only-supports-formalparameter-a","errorCode":null,"errorMessage":"invalid entry tag, only supports FormalParameter and Variable, got %s","messagePattern":"invalid entry tag, only supports FormalParameter and Variable, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":1231,"sourceCode":"func readVarEntry(entry *godwarf.Tree, image *Image) (name string, typ godwarf.Type, err error) {\n\tname, ok := entry.Val(dwarf.AttrName).(string)\n\tif !ok {\n\t\treturn \"\", nil, errors.New(\"malformed variable DIE (name)\")\n\t}\n\n\ttyp, err = entry.Type(image.dwarf, image.index, image.typeCache)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\treturn name, typ, nil\n}\n\n// Extracts the name and type of a variable from a dwarf entry\n// then executes the instructions given in the  DW_AT_location attribute to grab the variable's address\nfunc extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree, dictAddr uint64) (*Variable, error) {\n\tif entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable {\n\t\treturn nil, fmt.Errorf(\"invalid entry tag, only supports FormalParameter and Variable, got %s\", entry.Tag.String())\n\t}\n\n\tn, t, err := readVarEntry(entry, image)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt, err = resolveParametricType(bi, mem, t, dictAddr)\n\tif err != nil {\n\t\t// Log the error, keep going with t, which will be the shape type\n\t\tlogflags.DebuggerLogger().Errorf(\"could not resolve parametric type of %s: %v\", n, err)\n\t}\n\n\taddr, pieces, descr, err := bi.Location(entry, dwarf.AttrLocation, regs.PC(), regs, mem)\n\tif pieces != nil {\n\t\tvar cmem *compositeMemory\n\t\tif tgt != nil {\n\t\t\taddr, cmem, err = tgt.newCompositeMemory(mem, regs, pieces, descr, t.Common().ByteSize)","sourceCodeStart":1213,"sourceCodeEnd":1249,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L1213-L1249","documentation":"`extractVarInfoFromEntry` only knows how to materialize variables from DWARF DIEs whose tag is `DW_TAG_formal_parameter` or `DW_TAG_variable`. Any other DIE tag (e.g. DW_TAG_member, DW_TAG_constant, DW_TAG_typedef) passed to it produces this error. It is an internal invariant check used mainly when extracting function arguments/locals (e.g. for breakpoint argument extraction).","triggerScenarios":"Calling internal APIs that enumerate a function's parameter/local DIEs (e.g. function argument extraction at breakpoints, `Function.Arguments`-style flows) when the DIE iterator yields an entry with an unsupported tag; can happen with unusual compiler output or hand-written DWARF.","commonSituations":"Debugging binaries produced by non-standard toolchains or older/newer Go compilers emitting unexpected DIE tags; custom tooling that reuses delve's `proc` package to walk DIE trees and hits DW_TAG_constant or DW_TAG_member entries.","solutions":["Filter the DIE tree before extraction to only entries with dwarf.TagFormalParameter or dwarf.TagVariable.","Rebuild the debugged binary with the standard Go toolchain so DWARF has the expected structure.","If using delve as a library, skip unsupported tags instead of passing them to extractVarInfoFromEntry."],"exampleFix":"// before\nfor _, child := range fnTree.Children {\n    v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, child, dictAddr)\n    ...\n}\n// after\nfor _, child := range fnTree.Children {\n    if child.Tag != dwarf.TagFormalParameter && child.Tag != dwarf.TagVariable {\n        continue\n    }\n    v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, child, dictAddr)\n    ...\n}","handlingStrategy":"type-guard","validationCode":"if entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable {\n    continue // or handle explicitly before calling extractVarInfoFromEntry\n}","typeGuard":"func isVariableLikeTag(t dwarf.Tag) bool {\n    return t == dwarf.TagFormalParameter || t == dwarf.TagVariable\n}","tryCatchPattern":"v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, entry, dictAddr)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"invalid entry tag\") {\n        // skip non-variable DIE\n        return nil, nil\n    }\n    return nil, err\n}","preventionTips":["Filter DIE children by tag before extraction when walking function trees.","Build debugged binaries with the standard Go toolchain.","When embedding delve as a library, treat unsupported tags as skippable, not fatal."],"tags":["debugger","go","dwarf","internal-invariant"],"backgroundTag":"unsupported-dwarf-entry-tag","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}