{"record":{"id":"c8a8d78983650d23","repo":"gohugoio/hugo","slug":"failed-to-clone-s-v","errorCode":null,"errorMessage":"failed to clone %s: %v","messagePattern":"failed to clone (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/gitinfo.go","lineNumber":171,"sourceCode":"\n\tg.contentDir = gitRepo.TopLevelAbsPath\n\tg.repo = gitRepo\n\n\treturn g, nil\n}\n\nfunc (g *gitInfo) loadModuleRepos(cfg gitInfoConfig) error {\n\tfor _, mod := range cfg.Modules {\n\t\tif !isGitModule(mod) {\n\t\t\tcontinue\n\t\t}\n\n\t\tloadGitInfo := sync.OnceValues(func() (*gitmap.GitRepo, error) {\n\t\t\torigin := mod.Origin()\n\n\t\t\tcloneDir, err := ensureClone(cfg, origin)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to clone %s: %v\", origin.URL, err)\n\t\t\t}\n\n\t\t\trepo, err := mapModuleRepo(cfg, cloneDir, origin.Hash)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to map git repo for module %s: %v\", mod.Path(), err)\n\t\t\t}\n\t\t\treturn repo, nil\n\t\t})\n\n\t\tg.moduleRepoLoaders[mod.Dir()] = loadGitInfo\n\t}\n\n\treturn nil\n}\n\n// ensureClone ensures a blobless clone of the module's origin repo exists in the cache.\nfunc ensureClone(cfg gitInfoConfig, origin modules.ModuleOrigin) (string, error) {\n\tkey := \"repo_\" + hashing.XxHashFromStringHexEncoded(origin.URL)","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/gitinfo.go#L153-L189","documentation":"Emitted during git-info module loading when ensureClone() fails to create/refresh the blobless clone of a module's origin repository in the gitinfo cache. The %s is the origin URL; %v is the underlying failure.","triggerScenarios":"Raised in loadModuleRepos at gitinfo.go:171 when ensureClone(cfg, origin) returns an error for a module that isGitModule(mod). Occurs when the git clone command cannot be constructed or run, or the cache dir cannot be created.","commonSituations":"No network access or git credentials for a private module origin URL; git not installed or not on PATH inside the build container; gitinfo cache directory not writable (HUGO_CACHEDIR on read-only FS); origin URL mistyped in the module definition.","solutions":["Run `git clone <origin-url>` manually with the same credentials to confirm reachability.","Ensure git is installed and on PATH in the build environment (`git --version`).","Verify the gitinfo cache dir (under HUGO_CACHEDIR) is writable; chmod or pick a writable dir.","If the module is private, configure git credentials/SSH key or a deploy token before building.","Temporarily disable gitinfo (no .gitinfo / set enableGitInfo=false) to confirm it is the culprit."],"exampleFix":"# before: private module, no credentials\ngit clone https://github.com/myorg/privaterepo.git  # fails\n\n# after: provide credentials via env or git config\ngit config --global url.\"git@github.com:\".insteadOf \"https://github.com/\nexport HUGO_CACHEDIR=/tmp/hugocache","handlingStrategy":"validation","validationCode":"// Before enabling gitinfo, verify git availability and reachability of each module origin.\nif _, err := exec.LookPath(\"git\"); err != nil { return errors.New(\"git not found\") }\nfor _, o := range origins { if err := pingOrigin(o.URL); err != nil { return err } }","typeGuard":null,"tryCatchPattern":"if err := g.loadModuleRepos(cfg); err != nil {\n    // gitinfo is optional; log and continue without git data rather than fail the build\n    cfg.Logger.Warnf(\"gitinfo modules skipped: %v\", err)\n}","preventionTips":["Install git in build images; expose credentials for private modules.","Set a writable HUGO_CACHEDIR.","Disable gitinfo when not needed to avoid network dependency at build time."],"tags":["git","modules","network","cache","gitinfo","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}