{"record":{"id":"0e2149d315bfbdfc","repo":"apache/beam","slug":"unknown-file-format-symtab","errorCode":null,"errorMessage":"Unknown file format","messagePattern":"Unknown file format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/util/symtab/symtab.go","lineNumber":94,"sourceCode":"\tef, err := elf.NewFile(f)\n\tif err == nil {\n\t\treturn elfSymbolData(ef)\n\t}\n\n\t// then Mach-O\n\tmf, err := macho.NewFile(f)\n\tif err == nil {\n\t\treturn machoSymbolData(mf)\n\t}\n\n\t// finally try Windows PE format\n\tpf, err := pe.NewFile(f)\n\tif err == nil {\n\t\treturn peSymbolData(pf)\n\t}\n\n\t// Give up, we don't recognize it\n\treturn nil, nil, errors.New(\"Unknown file format\")\n}\n\n// elfSymbolData builds function symbol maps from an ELF file.\nfunc elfSymbolData(ef *elf.File) (map[uintptr]string, map[string]uintptr, error) {\n\tsyms, err := ef.Symbols()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\taddr2Sym := make(map[uintptr]string)\n\tsym2Addr := make(map[string]uintptr)\n\tfor _, sym := range syms {\n\t\tif elf.ST_TYPE(sym.Info) != elf.STT_FUNC {\n\t\t\tcontinue\n\t\t}\n\t\tvalue := uintptr(sym.Value)\n\t\taddr2Sym[value] = sym.Name\n\t\tsym2Addr[sym.Name] = value\n\t}","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/util/symtab/symtab.go#L76-L112","documentation":"Returned by symbolData in the symtab package after it tried and failed to parse the given file as ELF, Mach-O, and Windows PE in sequence. It means the on-disk object being loaded for symbol resolution is none of the supported executable formats — typically a truncated/corrupt binary, a text file, or a format this Go target cannot parse.","triggerScenarios":"Calling symtab.New on a binary that is not a valid ELF, Mach-O, or PE executable (or is corrupt/compressed).","commonSituations":"Pointing the symbol table at scripts, text files, or stripped/obfuscated binaries; attaching to a binary from an incompatible architecture or OS; passing a compressed binary (e.g. upx-packed or a .gz file).","solutions":["Ensure the path points to a real executable binary built for the running platform","Verify with `file <path>` that the binary is ELF/Mach-O/PE and uncorrupted","Rebuild or re-download the binary if it is truncated","Note that the caller may see this as an empty symbol table rather than a hard failure depending on New's error handling"],"exampleFix":"// verify before use\nout, _ := exec.Command(\"file\", binPath).CombinedOutput()\nif !strings.Contains(string(out), \"ELF\") && !strings.Contains(string(out), \"Mach-O\") && !strings.Contains(string(out), \"PE32\") {\n    return fmt.Errorf(\"%s is not a supported executable format\", binPath)\n}\nst, err := symtab.New(binPath)","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"file\", binPath).CombinedOutput()\nsupported := strings.Contains(string(out), \"ELF\") || strings.Contains(string(out), \"Mach-O\") || strings.Contains(string(out), \"PE32\")\nif err != nil || !supported { return fmt.Errorf(\"%s: unsupported binary format\", binPath) }","typeGuard":null,"tryCatchPattern":"m, r, err := symtab.New(binPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"Unknown file format\") { return fmt.Errorf(\"%s is not ELF/Mach-O/PE\", binPath) }\n    return err\n}","preventionTips":["Verify binary format with `file` before symbolization","Use the actual executable, not scripts or archives","Handle the error gracefully — symbolization is best-effort","Re-download/rebuild binaries that fail format checks"],"tags":["go","binary","elf","symbol-table"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}