golang/go · error
no DWARF data in Plan 9 file
Error message
no DWARF data in Plan 9 file
What it means
Returned unconditionally by plan9File.dwarf() in cmd/internal/objfile. Plan 9 a.out executables do not embed DWARF debug sections, so the objfile abstraction reports that DWARF is unavailable for this file type. It is the by-design 'not supported' answer for the Plan 9 backend.
Source
Thrown at src/cmd/internal/objfile/plan9obj.go:149
func (f *plan9File) goarch() string {
switch f.plan9.Magic {
case plan9obj.Magic386:
return "386"
case plan9obj.MagicAMD64:
return "amd64"
case plan9obj.MagicARM:
return "arm"
}
return ""
}
func (f *plan9File) loadAddress() (uint64, error) {
return 0, fmt.Errorf("unknown load address")
}
func (f *plan9File) dwarf() (*dwarf.Data, error) {
return nil, errors.New("no DWARF data in Plan 9 file")
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Accept that Plan 9 binaries have no DWARF; fall back to the gosym table or Plan 9 symbol table for symbolization.
- If DWARF is required, build for a target whose format carries it (ELF/Mach-O/PE) instead of plan9.
- Detect the file type before calling DWARF() and skip the call for plan9 files.
Example fix
// before
entry, _ := objfile.Open(plan9Bin)
data, err := entry.DWARF() // "no DWARF data in Plan 9 file"
// after: branch on arch/filetype and use gosym instead
data, err := entry.DWARF()
if err != nil {
// fall back to symbol table
tbl, _ := entry.PCLineTable()
} Defensive patterns
Strategy: type-guard
Validate before calling
// Detect plan9 binaries before requesting DWARF.
func isPlan9(path string) bool {
f, err := os.Open(path)
if err != nil { return false }
defer f.Close()
magic := make([]byte, 4)
io.ReadFull(f, magic)
// plan9 magics: 0x0000eb00, etc. — use debug/plan9obj for robustness
_, err = plan9obj.NewFile(f)
return err == nil
} Type guard
func isNoDWARFPlan9(err error) bool {
return err != nil && strings.Contains(err.Error(), "no DWARF data in Plan 9")
} Try / catch
data, err := entry.DWARF()
if err != nil && strings.Contains(err.Error(), "no DWARF data in Plan 9") {
// degrade to Plan 9 symbol table
return nil
} Prevention
- Detect GOOS/filetype before calling DWARF().
- For Plan 9 targets, plan a symbol-table fallback instead of DWARF.
- Cross-check that the target format is expected to carry DWARF.
When it happens
Trigger: Calling (*objfile.Entry).DWARF() on an Entry wrapping a Plan 9 a.out (detected by plan9obj magic). pprof or symbol tooling reading a binary built for a Plan 9 target.
Common situations: Cross-building for Plan 9 (GOOS=plan9) and then running a pprof/DWARF-consuming tool on the resulting binary. Using objfile on a Plan 9 binary expecting the same debug data as ELF.
Related errors
- no DWARF data in go object file
- subprogram DIE high not convertible to uint64
- subprogram DIE high_pc not convertible to uint64
- subprogram DIE high_pc unknown value class %s
- multiple toplevel scopes
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/f2705030a0669b44.
Report an issue: GitHub.