{"record":{"id":"12dbb8b38627b668","repo":"gohugoio/hugo","slug":"w","errorCode":null,"errorMessage":": %w","messagePattern":": %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/collect.go","lineNumber":888,"sourceCode":"\t\tif !files.IsComponentFolder(targetBase) {\n\t\t\treturn nil, fmt.Errorf(\"%s: mount target must be one of: %v\", errMsg, files.ComponentFolders)\n\t\t}\n\n\t\tif err := mnt.init(c.logger.Logger()); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: %w\", errMsg, err)\n\t\t}\n\n\t\tout = append(out, mnt)\n\t}\n\n\treturn out, nil\n}\n\nfunc (c *collector) wrapModuleNotFound(err error) error {\n\tif c.Client.ccfg.IgnoreModuleDoesNotExist {\n\t\treturn nil\n\t}\n\terr = fmt.Errorf(err.Error()+\": %w\", ErrNotExist)\n\tif c.GoModulesFilename == \"\" {\n\t\treturn err\n\t}\n\n\tbaseMsg := \"we found a go.mod file in your project, but\"\n\n\tswitch c.goBinaryStatus {\n\tcase goBinaryStatusNotFound:\n\t\treturn fmt.Errorf(baseMsg+\" you need to install Go to use it. See https://golang.org/dl/ : %q\", err)\n\tcase goBinaryStatusTooOld:\n\t\treturn fmt.Errorf(baseMsg+\" you need to a newer version of Go to use it. See https://golang.org/dl/ : %w\", err)\n\t}\n\n\treturn err\n}\n\ntype vendoredModule struct {\n\tOwner   Module","sourceCodeStart":870,"sourceCodeEnd":906,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/modules/collect.go#L870-L906","documentation":"Produced by collector.wrapModuleNotFound (modules/collect.go:888). When a referenced Go module cannot be resolved/downloaded, the original error is reformatted and wrapped with modules.ErrNotExist so callers can detect 'not found' via errors.Is. The empty-message leading \": %w\" means the wrapped error carries its own message; this is a re-wrapping point, not a user-authored message.","triggerScenarios":"Hugo tries to load a module import (module.imports path) that is not present in the local Go module cache and cannot be fetched; IgnoreModuleDoesNotExist is false (the default).","commonSituations":"Importing a private/typo'd module path; offline build with an unpopulated module cache; go.sum/go.mod referencing a module that was deleted from the remote; first build on a fresh machine without 'hugo mod tidy' having run.","solutions":["Run 'hugo mod tidy' to download and reconcile module dependencies.","Check the module path for typos and that it is reachable (network/proxy/credentials for private repos).","Pre-populate or vendor the module cache, or set ignoreVendor not needed: run 'hugo vendor' for offline builds.","Set imports[].ignoreConfig/avoidConfig or rely on ignoreModuleDoesNotExist only if missing modules are expected."],"exampleFix":"// before\n[[module.imports]]\npath = \"github.com/exmple/wrong-speling\"\n\n// after\n[[module.imports]]\npath = \"github.com/example/correct-module\"","handlingStrategy":"try-catch","validationCode":"// preflight: ensure each imported module is fetchable\nfor _, imp := range cfg.Module.Imports {\n    if imp.Path == \"\" { continue }\n    if err := verifyModuleReachable(imp.Path); err != nil {\n        return fmt.Errorf(\"module %s not reachable: %w\", imp.Path, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"// in Go code that drives Hugo\nerr := hugoModules.Collect(ctx)\nif errors.Is(err, modules.ErrNotExist) {\n    // run hugo mod tidy, or skip if optional\n}","preventionTips":["Run 'hugo mod tidy' in CI before building.","Populate the module cache or vendor deps for offline builds.","Double-check private module auth (GOPRIVATE, netrc)."],"tags":["hugo","go-modules","dependency-resolution"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}