{"record":{"id":"919e2d249058b396","repo":"golang/go","slug":"read-type-failed-v","errorCode":null,"errorMessage":"read type failed: %v","messagePattern":"read type failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/buildid/note.go","lineNumber":55,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tr := sect.Open()\n\t\tfor {\n\t\t\tvar namesize, descsize, noteType int32\n\t\t\terr = binary.Read(r, f.ByteOrder, &namesize)\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn nil, fmt.Errorf(\"read namesize failed: %v\", err)\n\t\t\t}\n\t\t\terr = binary.Read(r, f.ByteOrder, &descsize)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read descsize failed: %v\", err)\n\t\t\t}\n\t\t\terr = binary.Read(r, f.ByteOrder, &noteType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read type failed: %v\", err)\n\t\t\t}\n\t\t\tnoteName, err := readAligned4(r, namesize)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read name failed: %v\", err)\n\t\t\t}\n\t\t\tdesc, err := readAligned4(r, descsize)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read desc failed: %v\", err)\n\t\t\t}\n\t\t\tif name == string(noteName) && typ == noteType {\n\t\t\t\treturn desc, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil\n}\n\nvar elfGoNote = []byte(\"Go\\x00\\x00\")","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/buildid/note.go#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"Truncated or corrupt Go ELF binaries, interrupted link, partially copied artifacts, or malformed synthetic note sections.","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)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := buildid.ReadFile(bin); err != nil {\n    if strings.Contains(err.Error(), \"read type failed\") {\n        return rebuild(bin)\n    }\n    return err\n}","preventionTips":["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."],"tags":["buildid","elf","binary","corruption"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}