{"record":{"id":"7e56c9709a7355e6","repo":"golang/go","slug":"no-symbol-s-in-package-s","errorCode":null,"errorMessage":"no symbol %s in package%s","messagePattern":"no symbol (.+?) in package(.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cmd/go/internal/doc/doc.go","lineNumber":356,"sourceCode":"\t}\n\treturn path, object, nil\n}\n\n// failMessage creates a nicely formatted error message when there is no result to show.\nfunc failMessage(paths []string, symbol, method string) error {\n\tvar b bytes.Buffer\n\tif len(paths) > 1 {\n\t\tb.WriteString(\"s\")\n\t}\n\tb.WriteString(\" \")\n\tfor i, path := range paths {\n\t\tif i > 0 {\n\t\t\tb.WriteString(\", \")\n\t\t}\n\t\tb.WriteString(path)\n\t}\n\tif method == \"\" {\n\t\treturn fmt.Errorf(\"no symbol %s in package%s\", symbol, &b)\n\t}\n\treturn fmt.Errorf(\"no method or field %s.%s in package%s\", symbol, method, &b)\n}\n\n// parseArgs analyzes the arguments (if any) and returns the package\n// it represents, the part of the argument the user used to identify\n// the path (or \"\" if it's the current package) and the symbol\n// (possibly with a .method) within that package.\n// parseSymbol is used to analyze the symbol itself.\n// The boolean final argument reports whether it is possible that\n// there may be more directories worth looking at. It will only\n// be true if the package path is a partial match for some directory\n// and there may be more matches. For example, if the argument\n// is rand.Float64, we must scan both crypto/rand and math/rand\n// to find the symbol, and the first call will return crypto/rand, true.\nfunc parseArgs(ctx context.Context, flagSet *flag.FlagSet, args []string) (pkg *load.Package, path, symbol string, more bool) {\n\twd, err := os.Getwd()\n\tif err != nil {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/doc/doc.go#L338-L374","documentation":"Returned by go doc's failMessage when a symbol lookup found the package but not the requested symbol and no method component was given. The message lists every package path searched (pluralized with 's' when more than one) so the user can see where the lookup failed.","triggerScenarios":"Running `go doc <pkg>.<Symbol>` where <Symbol> does not exist in the resolved package(s); parseSymbol split off no method portion, so the bare-symbol branch is taken.","commonSituations":"Typo'd exported identifier; referencing an unexported symbol without realizing it; stale memory of an API renamed across versions; querying the wrong import path among duplicates (e.g. crypto/rand vs math/rand).","solutions":["List symbols with `go doc <pkg>` to confirm the exact exported name.","Check spelling and capitalization (Go is case-sensitive).","If the symbol is unexported, it is intentionally not documented.","Disambiguate the package path (rand -> math/rand or crypto/rand)."],"exampleFix":"# before\n$ go doc math/rand.notasymbol\n# -> no symbol notasymbol in package math/rand\n\n# after: list first, then query\n$ go doc math/rand\n$ go doc math/rand.Intn","handlingStrategy":"validation","validationCode":"// verify a symbol exists before deep use\nif out, _ := exec.Command(\"go\", \"doc\", \"-all\", pkg).Output(); !bytes.Contains(out, []byte(symbol)) {\n    return fmt.Errorf(\"symbol %s not found; run `go doc %s`\", symbol, pkg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List package symbols with `go doc <pkg>` first.","Remember exported names start with uppercase.","Disambiguate duplicate package names (math/rand vs crypto/rand)."],"tags":["doc","symbol","lookup","user-input"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}