{"record":{"id":"6cca1dba716a50a5","repo":"apache/beam","slug":"failed-to-reverse-lookup-known-function-s-v","errorCode":null,"errorMessage":"failed to reverse lookup known function %s: %v","messagePattern":"failed to reverse lookup known function (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/util/symtab/symtab.go","lineNumber":58,"sourceCode":"func New(filename string) (*SymbolTable, error) {\n\taddr2Sym, sym2Addr, err := symbolData(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsym := &SymbolTable{\n\t\taddr2Sym: addr2Sym,\n\t\tsym2Addr: sym2Addr,\n\t}\n\n\t// Work out the offset between the file addresses and the\n\t// runtime addreses, in case this is a position independent\n\t// executable.\n\truntimeAddr := reflect.ValueOf(New).Pointer()\n\tname := fnname()\n\tfileAddr, err := sym.Sym2Addr(name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to reverse lookup known function %s: %v\", name, err)\n\t}\n\tsym.offset = runtimeAddr - fileAddr\n\n\treturn sym, nil\n}\n\n// symbolData reads the file's symbol table and builds two maps,\n// one from symbol to address and one from address to symbol.\n// The maps only include function symbols.\nfunc symbolData(filename string) (map[uintptr]string, map[string]uintptr, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer f.Close()\n\n\t// First try ELF\n\tef, err := elf.NewFile(f)","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/util/symtab/symtab.go#L40-L76","documentation":"symtab.New computes a base address offset by reverse-looking up a known function's name to a symbol address via sym.Sym2Addr. When the runtime symbol table cannot resolve the function name (typically because the binary is stripped or symbol lookup is unsupported on the platform), it returns this error.","triggerScenarios":"Calling symtab.New (from package init or initResolver) when Sym2Addr fails to resolve the name returned by fnname() in the running binary.","commonSituations":"Running a stripped Go binary (-ldflags \"-s -w\") in Docker; minimized production builds; platforms where symbol table lookup of file addresses is unsupported; Go version changes altering symbol layout.","solutions":["Build without stripping symbols: remove -s -w from ldflags so runtime symbol lookup works.","Verify the target platform supports the Sym2Addr implementation; upgrade Beam/Go if a fix is available.","If infeasible, avoid the code path that requires symtab (payload function symbolization) or file an issue upstream."],"exampleFix":"// before\ngo build -ldflags=\"-s -w\" -o worker ./cmd/worker\n// after\ngo build -o worker ./cmd/worker","handlingStrategy":"fallback","validationCode":"if _, err := symtab.New(); err != nil {\n    log.Printf(\"symtab unavailable: %v — running without symbolization\", err)\n}","typeGuard":null,"tryCatchPattern":"sym, err := symtab.New()\nif err != nil {\n    log.Fatalf(\"symbol table init failed (stripped binary?): %v\", err)\n}","preventionTips":["Do not strip symbols (-s -w) from Beam worker binaries.","Test worker binaries in the same build configuration you ship."],"tags":["go","runtime","symbols","symtab"],"backgroundTag":"module-init-failed","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"}