golang/go · error
read type failed: %v
Error message
read type failed: %v
What it means
Returned when binary.Read of the noteType field fails after namesize and descsize succeeded. The third 4-byte header word could not be read, so the note type (e.g. NT_VERSION for Go build ID) is unknown. Same loop, same corruption class as errors 1227/1228.
Source
Thrown at src/cmd/internal/buildid/note.go:55
continue
}
r := sect.Open()
for {
var namesize, descsize, noteType int32
err = binary.Read(r, f.ByteOrder, &namesize)
if err != nil {
if err == io.EOF {
break
}
return nil, fmt.Errorf("read namesize failed: %v", err)
}
err = binary.Read(r, f.ByteOrder, &descsize)
if err != nil {
return nil, fmt.Errorf("read descsize failed: %v", err)
}
err = binary.Read(r, f.ByteOrder, ¬eType)
if err != nil {
return nil, fmt.Errorf("read type failed: %v", err)
}
noteName, err := readAligned4(r, namesize)
if err != nil {
return nil, fmt.Errorf("read name failed: %v", err)
}
desc, err := readAligned4(r, descsize)
if err != nil {
return nil, fmt.Errorf("read desc failed: %v", err)
}
if name == string(noteName) && typ == noteType {
return desc, nil
}
}
}
return nil, nil
}
var elfGoNote = []byte("Go\x00\x00")View on GitHub (pinned to b6b368adc5)
Solutions
- Rebuild the binary: `go build`/`go install` from source.
- Clean cache with `go clean -cache`.
- Validate the binary is a complete Go ELF executable (`file`, checksum).
- Re-fetch the artifact if downloaded (partial transfer).
Defensive patterns
Strategy: try-catch
Try / catch
if _, err := buildid.ReadFile(bin); err != nil {
if strings.Contains(err.Error(), "read type failed") {
return rebuild(bin)
}
return err
} Prevention
- Treat partial downloads as corrupt: re-fetch the binary.
- Don't strip or rewrite ELF note sections with third-party tools.
- Keep build cache clean across toolchain upgrades.
When it happens
Trigger: An ELF note section long enough for namesize+descsize (8 bytes) but shorter than 12 bytes, so the type field read fails. Emitted by the note iteration loop in note.go.
Common situations: Truncated or corrupt Go ELF binaries, interrupted link, partially copied artifacts, or malformed synthetic note sections.
Related errors
- read namesize failed: %v
- read descsize failed: %v
- read name failed: %v
- read desc failed: %v
- cannot find __text section
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/919e2d249058b396.
Report an issue: GitHub.