{"record":{"id":"fa8d9458dcc7e2e2","repo":"golang/go","slug":"no-such-package-s","errorCode":null,"errorMessage":"no such package: %s","messagePattern":"no such package: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/doc/doc.go","lineNumber":255,"sourceCode":"\t\t\treturn doPkgsite(ctx, \"std\", \"\")\n\t\t}\n\n\t\t// If args are provided, we need to figure out which page to open on the pkgsite\n\t\t// instance. Run the logic below to determine a match for a symbol, method,\n\t\t// or field, but don't actually print the documentation to the output.\n\t\twriter = io.Discard\n\t}\n\tvar paths []string\n\tvar symbol, method string\n\t// Loop until something is printed.\n\tdirs.Reset()\n\tfor i := 0; ; i++ {\n\t\tbuildPackage, userPath, sym, more := parseArgs(ctx, flagSet, flagSet.Args())\n\t\tif i > 0 && !more { // Ignore the \"more\" bit on the first iteration.\n\t\t\treturn failMessage(paths, symbol, method)\n\t\t}\n\t\tif buildPackage == nil {\n\t\t\treturn fmt.Errorf(\"no such package: %s\", userPath)\n\t\t}\n\n\t\t// The builtin package needs special treatment: its symbols are lower\n\t\t// case but we want to see them, always.\n\t\tif buildPackage.ImportPath == \"builtin\" {\n\t\t\tunexported = true\n\t\t}\n\n\t\tsymbol, method = parseSymbol(flagSet, sym)\n\t\tpkg := parsePackage(writer, buildPackage, userPath)\n\t\tpaths = append(paths, pkg.prettyPath())\n\n\t\tdefer func() {\n\t\t\tpkg.flush()\n\t\t\te := recover()\n\t\t\tif e == nil {\n\t\t\t\treturn\n\t\t\t}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/doc/doc.go#L237-L273","documentation":"Returned by the `go doc` argument loop when parseArgs returns a nil buildPackage for the requested path. The package could not be located/resolved at all, so there is nothing to document. Triggered after the loop's first iteration regardless of the 'more' bit, since a nil package with no further candidates is a dead end.","triggerScenarios":"Running `go doc <path>` where <path> does not resolve to any importable package — typo, nonexistent module path, package behind a build constraint that excludes the current tags, or a path that only matches directories but not a package.","commonSituations":"Typo'd import path; package behind GOOS/GOARCH or build tags not active; missing dependency (`go mod tidy` needed); pointing at a directory with no .go files.","solutions":["Verify the package path with `go list ./...` or `go list -m all`.","Run `go mod tidy` to ensure dependencies are present.","Check build tags/GOOS/GOARCH if the package is platform-specific.","Correct typos in the import path."],"exampleFix":"# before\n$ go doc exampl.com/foobar   # typo\n# -> no such package: exampl.com/foobar\n\n# after\n$ go doc example.com/foobar","handlingStrategy":"validation","validationCode":"// confirm the package resolves before invoking doc\nif out, err := exec.Command(\"go\", \"list\", userPath).CombinedOutput(); err != nil {\n    return fmt.Errorf(\"package does not resolve: %s\", out)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"no such package\") {\n    // suggest `go list ./...` matches and retry\n}","preventionTips":["Run `go list ./...` to discover valid paths first.","Keep `go mod tidy` current so paths resolve.","Watch build tags for platform-specific packages."],"tags":["doc","package","lookup","user-input"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}