{"record":{"id":"e507b7bf259eda65","repo":"gohugoio/hugo","slug":"failed-to-get-q-w","errorCode":null,"errorMessage":"failed to get %q: %w","messagePattern":"failed to get %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/client.go","lineNumber":358,"sourceCode":"\t\t\t} else if update && patch {\n\t\t\t\targs = append(args, \"-u=patch\")\n\t\t\t}\n\t\t\targs = append(args, m)\n\n\t\t\tif err := c.get(args...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn c.get(args...)\n}\n\nfunc (c *Client) get(args ...string) error {\n\tif err := c.runGo(context.Background(), c.logger.StdOut(), append([]string{\"get\"}, args...)...); err != nil {\n\t\treturn fmt.Errorf(\"failed to get %q: %w\", args, err)\n\t}\n\treturn nil\n}\n\n// Init initializes this as a Go Module with the given path.\n// If path is empty, Go will try to guess.\n// If this succeeds, this project will be marked as Go Module.\nfunc (c *Client) Init(path string) error {\n\terr := c.runGo(context.Background(), c.logger.StdOut(), \"mod\", \"init\", path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to init modules: %w\", err)\n\t}\n\n\tc.GoModulesFilename = filepath.Join(c.ccfg.WorkingDir, goModFilename)\n\n\treturn nil\n}\n","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/modules/client.go#L340-L376","documentation":"Returned by Client.get (the lower-level runner behind Client.Get / `hugo mod get`) when c.runGo(... \"get\" ...) fails. The args slice is quoted in the message; the underlying error is wrapped with %w. runGo can swallow exec.ErrNotFound (recording goBinaryStatusNotFound) and some 'too old Go' errors, so a surfaced error here typically means Go ran but the get command itself failed.","triggerScenarios":"Running `hugo mod get <module>` or `hugo mod get -u` where `go get` exits non-zero: module not found on the proxy, network failure, unknown revision, go.sum mismatch, or an invalid module path/version argument.","commonSituations":"Module path typo or missing vCS ref (force-pushed tag); GOPROXY blocked/unreachable in corporate networks; private module without GOPRIVATE set; version string malformed; go.sum out of date after a manual go.mod edit.","solutions":["Read the wrapped error and the stderr hint Hugo prints (it flags 'invalid version: unknown revision' with remediation guidance).","For unknown revisions, edit go.mod to a valid branch/tag (e.g. master) then `hugo mod graph` to re-resolve.","Set GOPRIVATE/GONOPROXY/GOPROXY appropriately in your environment or [module] config for private/restricted registries.","Run `go get <module>@<version>` directly to reproduce and get Go's native diagnostics, then fix go.mod/go.sum.","Run `hugo mod tidy` to reconcile requirements and sums."],"exampleFix":"# before\nhugo mod get github.com/foo/bar@v0.9.0   # tag force-pushed away -> unknown revision\n\n# after\n# edit go.mod require line to a valid ref\nhugo mod get github.com/foo/bar@master\nhugo mod tidy","handlingStrategy":"retry","validationCode":"// Validate module path + reachability before `hugo mod get`.\nfunc modulePathValid(path string) error {\n    return module.CheckPath(path) // nil == valid Go module path\n}\n\nfunc proxyReachable() error {\n    // e.g. HEAD check against GOPROXY in your environment\n    return nil\n}","typeGuard":"func isProbablyModule(path string) bool {\n    return module.CheckPath(path) == nil\n}","tryCatchPattern":"if err := client.Get(args...); err != nil {\n    if strings.Contains(err.Error(), \"unknown revision\") {\n        // edit go.mod to a valid branch and retry\n    } else if isTransient(err) {\n        // network blip: retry with backoff\n    }\n}","preventionTips":["Pin module versions to existing tags/commits; avoid branch-only refs that can be force-pushed away.","Configure GOPRIVATE for private modules so Go does not hit the public proxy.","Run `go get <module>@<ver>` directly to reproduce and diagnose.","Keep go.sum in sync via `hugo mod tidy`."],"tags":["modules","go-get","network","go-modules","go-mod"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}