{"record":{"id":"10af49a035984224","repo":"gohugoio/hugo","slug":"git-clone-w","errorCode":null,"errorMessage":"git clone: %w","messagePattern":"git clone: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/gitinfo.go","lineNumber":211,"sourceCode":"\t\t\treturn err\n\t\t}\n\n\t\tvar stderr bytes.Buffer\n\t\targs := []any{\n\t\t\t\"clone\",\n\t\t\t\"--filter=blob:none\",\n\t\t\t\"--no-checkout\",\n\t\t\torigin.URL,\n\t\t\tcloneDir,\n\t\t\thexec.WithStdout(io.Discard),\n\t\t\thexec.WithStderr(&stderr),\n\t\t}\n\n\t\tcfg.Logger.Infof(\"Cloning gitinfo for repo %s into cache\", origin.URL)\n\n\t\tcmd, err := cfg.Deps.ExecHelper.New(\"git\", args...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"git clone: %w\", err)\n\t\t}\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn fmt.Errorf(\"git clone %s: %w: %s\", origin.URL, err, stderr.String())\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn cfg.GitInfoCache.AbsFilenameFromID(info.Name), nil\n}\n\nfunc mapModuleRepo(cfg gitInfoConfig, repoDir, revision string) (*gitmap.GitRepo, error) {\n\topts := gitmap.Options{\n\t\tRepository: repoDir,\n\t\tRevision:   revision,\n\t\tGetGitCommandFunc: func(stdout, stderr io.Writer, args ...string) (gitmap.Runner, error) {\n\t\t\tvar argsv []any","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/gitinfo.go#L193-L229","documentation":"Returned inside ensureClone() when the git command object itself cannot be created via ExecHelper.New(\"git\", ...). This is a command-construction failure (not a clone execution failure) — the helper refused to build the 'git clone ...' command.","triggerScenarios":"Raised at gitinfo.go:211 when cfg.Deps.ExecHelper.New(\"git\", clone args...) returns an error — e.g. git binary not found, exec helper misconfigured, or an option/handler rejected the command before it could run.","commonSituations":"git executable missing in the container/CI image; exec helper blocked by a security policy; HUGO environment configured to disallow external commands; broken hexec setup during a Hugo upgrade.","solutions":["Confirm git is installed and discoverable: `which git` / `git --version` in the build environment.","Check that no security/exec policy (e.g. HUGO_DISABLEUNKNOWN) blocks running external git commands.","If embedding Hugo, ensure ExecHelper is properly initialized on Deps.","Disable gitinfo (enableGitInfo=false) if git is intentionally unavailable."],"exampleFix":"# before: minimal CI image missing git\nFROM alpine\nRUN hugo build\n\n# after: install git\nFROM alpine\nRUN apk add --no-cache git\nRUN hugo build","handlingStrategy":"validation","validationCode":"// Verify git binary presence before constructing the command.\nif _, err := exec.LookPath(\"git\"); err != nil { return fmt.Errorf(\"git required for gitinfo: %w\", err) }","typeGuard":null,"tryCatchPattern":"cmd, err := cfg.Deps.ExecHelper.New(\"git\", args...)\nif err != nil {\n    // command construction failed; treat gitinfo as unavailable\n    cfg.Logger.Warnf(\"gitinfo disabled: %v\", err)\n    return nil // non-fatal\n}","preventionTips":["Bundle git in CI/Docker images used for Hugo builds.","Ensure ExecHelper is initialized when embedding Hugo.","Disable enableGitInfo in environments without git."],"tags":["git","exec","gitinfo","environment","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}