{"record":{"id":"16e88eb7738af94d","repo":"golang/go","slug":"no-s-symbol-found","errorCode":null,"errorMessage":"no %s symbol found","messagePattern":"no (.+?) symbol found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/pe.go","lineNumber":166,"sourceCode":"\ttextStart = imageBase + uint64(sect.VirtualAddress)\n\ttext, err = sect.Data()\n\treturn\n}\n\nfunc findPESymbol(f *pe.File, name string) (*pe.Symbol, error) {\n\tfor _, s := range f.Symbols {\n\t\tif s.Name != name {\n\t\t\tcontinue\n\t\t}\n\t\tif s.SectionNumber <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: invalid section number %d\", name, s.SectionNumber)\n\t\t}\n\t\tif len(f.Sections) < int(s.SectionNumber) {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: section number %d is larger than max %d\", name, s.SectionNumber, len(f.Sections))\n\t\t}\n\t\treturn s, nil\n\t}\n\treturn nil, fmt.Errorf(\"no %s symbol found\", name)\n}\n\nfunc loadPETable(f *pe.File, sname, ename string) ([]byte, error) {\n\tssym, err := findPESymbol(f, sname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tesym, err := findPESymbol(f, ename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ssym.SectionNumber != esym.SectionNumber {\n\t\treturn nil, fmt.Errorf(\"%s and %s symbols must be in the same section\", sname, ename)\n\t}\n\tsect := f.Sections[ssym.SectionNumber-1]\n\tdata, err := sect.Data()\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/pe.go#L148-L184","documentation":"In `findPESymbol`, the code iterates through the PE symbol table looking for a symbol by exact name match. If no symbol with the requested name exists in the entire table, this error is returned. This is used internally to find Go runtime symbols like `runtime.pclntab`, `runtime.epclntab`, `runtime.symtab`, and `runtime.esymtab`.","triggerScenarios":"Calling `findPESymbol` (typically during `loadPETable` or `pcln`) for a symbol name that does not exist in the PE symbol table. Most commonly this happens when looking for `runtime.pclntab` / `runtime.epclntab` in a binary where those symbols were stripped during linking.","commonSituations":"Analyzing a Windows binary built with `-ldflags=-s` which strips the symbol table. Examining a non-Go PE binary that naturally lacks Go runtime symbols. Using an older Go version where the symbol naming convention differs. The binary was built with a custom linker that omitted these symbols.","solutions":["Rebuild the binary without symbol stripping: remove `-ldflags=-s` and `-ldflags=-w`.","Confirm the symbol exists: `go tool nm <file> | grep pclntab`.","Ensure the binary was built with Go and not another language if you need Go runtime symbols.","For production binaries where stripping is required, accept that runtime table access will fail in analysis tools."],"exampleFix":"// before — stripped binary lacks runtime symbols\n$ go build -ldflags=\"-s\" -o app.exe\nf, _ := objfile.Open(\"app.exe\")\n// pcln() → findPESymbol(\"runtime.pclntab\") → error: no symbol found\n\n// after — keep symbols for analysis\n$ go build -o app.exe\nf, _ := objfile.Open(\"app.exe\")\ntable, err := f.PCLineTable()  // succeeds","handlingStrategy":"validation","validationCode":"// Check if required symbols exist in PE before lookup\nfunc hasPESymbol(path, name string) bool {\n    f, err := pe.Open(path)\n    if err != nil { return false }\n    defer f.Close()\n    for _, s := range f.Symbols {\n        if s.Name == name { return true }\n    }\n    return false\n}\n\n// Usage:\nif !hasPESymbol(\"app.exe\", \"runtime.pclntab\") {\n    return fmt.Errorf(\"binary is stripped — rebuild without -ldflags=-s\")\n}","typeGuard":null,"tryCatchPattern":"sym, err := findPESymbol(pe, \"runtime.pclntab\")\nif err != nil && strings.Contains(err.Error(), \"no\") && strings.Contains(err.Error(), \"symbol found\") {\n    // Runtime symbols are missing — likely stripped binary\n    return fmt.Errorf(\"%s — rebuild without -ldflags=-s for analysis\", err)\n}","preventionTips":["Do not use -ldflags=-s -w on binaries that need profiling or debugging.","Verify runtime symbols exist with 'go tool nm <file>' before analysis.","Keep a non-stripped build alongside production builds for debugging."],"tags":["pe","windows","symbol-table","missing-symbol","objfile","pclntab"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}