apache/beam · error

failed to reverse lookup known function

Error message

failed to reverse lookup known function %s: %v

What it means

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.

Solutions

  1. Build without stripping symbols: remove -s -w from ldflags so runtime symbol lookup works.
  2. Verify the target platform supports the Sym2Addr implementation; upgrade Beam/Go if a fix is available.
  3. If infeasible, avoid the code path that requires symtab (payload function symbolization) or file an issue upstream.

Example fix

// before
go build -ldflags="-s -w" -o worker ./cmd/worker
// after
go build -o worker ./cmd/worker
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := symtab.New(); err != nil {
    log.Printf("symtab unavailable: %v — running without symbolization", err)
}

Try / catch

sym, err := symtab.New()
if err != nil {
    log.Fatalf("symbol table init failed (stripped binary?): %v", err)
}

Prevention

When it happens

Trigger: Calling symtab.New (from package init or initResolver) when Sym2Addr fails to resolve the name returned by fnname() in the running binary.

Common situations: 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.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/6cca1dba716a50a5. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/util/symtab/symtab.go:58

func New(filename string) (*SymbolTable, error) {
	addr2Sym, sym2Addr, err := symbolData(filename)
	if err != nil {
		return nil, err
	}

	sym := &SymbolTable{
		addr2Sym: addr2Sym,
		sym2Addr: sym2Addr,
	}

	// Work out the offset between the file addresses and the
	// runtime addreses, in case this is a position independent
	// executable.
	runtimeAddr := reflect.ValueOf(New).Pointer()
	name := fnname()
	fileAddr, err := sym.Sym2Addr(name)
	if err != nil {
		return nil, fmt.Errorf("failed to reverse lookup known function %s: %v", name, err)
	}
	sym.offset = runtimeAddr - fileAddr

	return sym, nil
}

// symbolData reads the file's symbol table and builds two maps,
// one from symbol to address and one from address to symbol.
// The maps only include function symbols.
func symbolData(filename string) (map[uintptr]string, map[string]uintptr, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, nil, err
	}
	defer f.Close()

	// First try ELF
	ef, err := elf.NewFile(f)

View on GitHub (pinned to 12126d8942)