go-delve/delve · error
invalid entry tag, only supports FormalParameter and Variabl
Error message
invalid entry tag, only supports FormalParameter and Variable, got %s
What it means
`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).
Source
Thrown at pkg/proc/variables.go:1231
func readVarEntry(entry *godwarf.Tree, image *Image) (name string, typ godwarf.Type, err error) {
name, ok := entry.Val(dwarf.AttrName).(string)
if !ok {
return "", nil, errors.New("malformed variable DIE (name)")
}
typ, err = entry.Type(image.dwarf, image.index, image.typeCache)
if err != nil {
return "", nil, err
}
return name, typ, nil
}
// Extracts the name and type of a variable from a dwarf entry
// then executes the instructions given in the DW_AT_location attribute to grab the variable's address
func extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree, dictAddr uint64) (*Variable, error) {
if entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable {
return nil, fmt.Errorf("invalid entry tag, only supports FormalParameter and Variable, got %s", entry.Tag.String())
}
n, t, err := readVarEntry(entry, image)
if err != nil {
return nil, err
}
t, err = resolveParametricType(bi, mem, t, dictAddr)
if err != nil {
// Log the error, keep going with t, which will be the shape type
logflags.DebuggerLogger().Errorf("could not resolve parametric type of %s: %v", n, err)
}
addr, pieces, descr, err := bi.Location(entry, dwarf.AttrLocation, regs.PC(), regs, mem)
if pieces != nil {
var cmem *compositeMemory
if tgt != nil {
addr, cmem, err = tgt.newCompositeMemory(mem, regs, pieces, descr, t.Common().ByteSize)View on GitHub (pinned to a23773e6c3)
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.
Example fix
// before
for _, child := range fnTree.Children {
v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, child, dictAddr)
...
}
// after
for _, child := range fnTree.Children {
if child.Tag != dwarf.TagFormalParameter && child.Tag != dwarf.TagVariable {
continue
}
v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, child, dictAddr)
...
} Defensive patterns
Strategy: type-guard
Validate before calling
if entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable {
continue // or handle explicitly before calling extractVarInfoFromEntry
} Type guard
func isVariableLikeTag(t dwarf.Tag) bool {
return t == dwarf.TagFormalParameter || t == dwarf.TagVariable
} Try / catch
v, err := extractVarInfoFromEntry(tgt, bi, image, regs, mem, entry, dictAddr)
if err != nil {
if strings.HasPrefix(err.Error(), "invalid entry tag") {
// skip non-variable DIE
return nil, nil
}
return nil, err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unable to find function context
- unable to find locals: no debug information present in binar
- malformed map type: buckets, oldbuckets or overflow field no
- ctx variable not found
- ep variable not found
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/9651c3900a794e08.
Report an issue: GitHub.