{"record":{"id":"3a325b938a74e0da","repo":"go-delve/delve","slug":"malformed-variable-die-name","errorCode":null,"errorMessage":"malformed variable DIE (name)","messagePattern":"malformed variable DIE \\(name\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":1216,"sourceCode":"\t\tif field.Name == memberName {\n\t\t\treturn structVar.toField(field)\n\t\t}\n\t\tif field.Name == \"&\"+memberName && closure {\n\t\t\tf, err := structVar.toField(field)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn f.maybeDereference(), nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"%s has no member %s\", vname, memberName)\n}\n\nfunc 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)","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L1198-L1234","documentation":"readVarEntry extracts the name of a variable from its DWARF DIE (debug info entry). If the DIE has no dwarf.AttrName attribute, or the attribute is not a string, the variable entry is considered malformed and this error is thrown. This indicates corrupt, truncated, or unexpectedly-shaped DWARF debug information rather than a bug in the caller's code.","triggerScenarios":"Calling APIs that resolve variables by DIE (e.g. variable evaluation that goes through readVarEntry) when the compiled binary's DWARF info lacks a name attribute on the variable DIE — typically due to stripped/mangled debug info, compiler bugs, or optimizations emitting partial DIEs.","commonSituations":"Debugging binaries built with unusual flags (-w -s then partially restored symbols), binaries produced by non-standard toolchains or linkers, corrupted executables, or newer Go/compiler versions emitting DWARF shapes the delve version in use does not understand.","solutions":["Rebuild the binary with full, unstripped debug info (do not use -ldflags='-s -w') and retry.","Upgrade delve to the latest version so it can parse DWARF emitted by your Go compiler version.","Verify the executable is not truncated/corrupted (rebuild or re-download it).","If the binary comes from a third party, ask for a build with standard Go toolchain flags.","Bisect the Go toolchain version if the failure started after a compiler upgrade."],"exampleFix":"// before\ndlv exec ./app-stripped-binary\n// after\ngo build -gcflags=\"all=-N -l\" -o ./app .\ndlv exec ./app","handlingStrategy":"type-guard","validationCode":"name, ok := entry.Val(dwarf.AttrName).(string)\nif !ok || name == \"\" {\n    // skip or regenerate debug info for this DIE\n    return\n}","typeGuard":"func hasVarName(entry *godwarf.Tree) bool {\n    _, ok := entry.Val(dwarf.AttrName).(string)\n    return ok\n}","tryCatchPattern":"v, err := readVarEntry(tree, image)\nif err != nil {\n    if strings.Contains(err.Error(), \"malformed variable DIE\") {\n        // fall back: skip this variable, log DIE offset\n        return\n    }\n    return err\n}","preventionTips":["Always build debug binaries without -ldflags=\"-s -w\"","Keep delve and Go toolchain versions aligned","Verify binary integrity (checksum) when downloaded from elsewhere"],"tags":["debugger","dwarf","go"],"backgroundTag":"malformed-dwarf-die","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}