{"record":{"id":"144e0527f87958b9","repo":"golang/go","slug":"open-s-unrecognized-archive-member-s","errorCode":null,"errorMessage":"open %s: unrecognized archive member %s","messagePattern":"open (.+?): unrecognized archive member (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/goobj.go","lineNumber":72,"sourceCode":"\t\t\t}\n\t\t\tentries = append(entries, &Entry{\n\t\t\t\tname: e.Name,\n\t\t\t\traw:  &goobjFile{e.Obj, r, f, arch},\n\t\t\t})\n\t\t\tcontinue\n\t\tcase archive.EntryNativeObj:\n\t\t\tnr := io.NewSectionReader(f, e.Offset, e.Size)\n\t\t\tfor _, try := range openers {\n\t\t\t\tif raw, err := try(nr); err == nil {\n\t\t\t\t\tentries = append(entries, &Entry{\n\t\t\t\t\t\tname: e.Name,\n\t\t\t\t\t\traw:  raw,\n\t\t\t\t\t})\n\t\t\t\t\tcontinue L\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"open %s: unrecognized archive member %s\", f.Name(), e.Name)\n\t}\n\treturn &File{f, entries}, nil\n}\n\nfunc goobjName(name string, ver int) string {\n\tif ver == 0 {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"%s<%d>\", name, ver)\n}\n\ntype goobjReloc struct {\n\tOff  int32\n\tSize uint8\n\tType objabi.RelocType\n\tAdd  int64\n\tSym  string\n}","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/goobj.go#L54-L90","documentation":"When opening a Go archive (`.a` file), the loader iterates through archive members. For `EntryNativeObj` members, it tries each registered opener (ELF, Mach-O, PE, Plan9, XCOFF). If none can parse the member, this error is returned. It means the archive contains a native object file in a format that no registered opener recognizes.","triggerScenarios":"Calling `objfile.Open` on a Go archive file where one of the member objects is corrupt, truncated, or in an unsupported binary format. Also triggered when the archive was built for an architecture or OS that the current openers do not cover.","commonSituations":"Mixing archives built with different Go versions or for different platforms. Archive corruption from incomplete builds or filesystem issues. Using a Go toolchain version that does not support the object format used in the archive.","solutions":["Rebuild the archive from source with the current Go toolchain to ensure format compatibility.","Verify archive integrity: `go tool nm <archive>` or `ar t <archive>`.","Ensure all member objects target the same GOOS/GOARCH.","Check for truncation or corruption: rebuild if the archive was incompletely written."],"exampleFix":"// before — stale archive from old toolchain\nf, err := objfile.Open(\"old.a\")  // fails: unrecognized member\n\n// after — rebuild archive with current toolchain\n$ go build -o lib.a ./...\nf, err := objfile.Open(\"lib.a\")  // succeeds","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"f, err := objfile.Open(archivePath)\nif err != nil {\n    if strings.Contains(err.Error(), \"unrecognized archive member\") {\n        // Rebuild the archive from source\n        log.Printf(\"Archive may be stale or corrupt, rebuilding...\")\n        return rebuildAndRetry(archivePath)\n    }\n    return err\n}","preventionTips":["Always rebuild archives from source when upgrading Go versions.","Do not mix archives built for different GOOS/GOARCH.","Verify archive integrity with 'ar t' or 'go tool nm' before analysis."],"tags":["archive","goobj","binary-format","objfile"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}