{"record":{"id":"af294915054938b0","repo":"gohugoio/hugo","slug":"module-does-not-exist","errorCode":null,"errorMessage":"module does not exist","messagePattern":"module does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/collect.go","lineNumber":49,"sourceCode":"\t\"github.com/gobwas/glob\"\n\t\"github.com/gohugoio/hugo/common/herrors\"\n\t\"github.com/gohugoio/hugo/common/hmaps\"\n\t\"github.com/gohugoio/hugo/common/loggers\"\n\t\"github.com/gohugoio/hugo/common/paths\"\n\t\"github.com/gohugoio/hugo/common/version\"\n\t\"golang.org/x/mod/module\"\n\n\t\"github.com/spf13/cast\"\n\n\t\"github.com/gohugoio/hugo/parser/metadecoders\"\n\n\t\"github.com/gohugoio/hugo/hugofs/files\"\n\n\t\"github.com/gohugoio/hugo/config\"\n\t\"github.com/spf13/afero\"\n)\n\nvar ErrNotExist = errors.New(\"module does not exist\")\n\nconst vendorModulesFilename = \"modules.txt\"\n\nfunc (h *Client) Collect() (ModulesConfig, error) {\n\tmc, coll := h.collect(true)\n\tif coll.err != nil {\n\t\treturn mc, coll.err\n\t}\n\n\tif err := (&mc).setActiveMods(h.logger); err != nil {\n\t\treturn mc, err\n\t}\n\n\tif h.ccfg.HookBeforeFinalize != nil {\n\t\tif err := h.ccfg.HookBeforeFinalize(&mc); err != nil {\n\t\t\treturn mc, err\n\t\t}\n\t}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/modules/collect.go#L31-L67","documentation":"ErrNotExist is the sentinel defined in modules/collect.go:49 and returned by the module collector when a referenced/imported module cannot be found in the module graph. Collect/collect use it to signal a missing module dependency during site setup.","triggerScenarios":"Importing a Hugo module (in hugo.toml [[module.imports]] or hugo.mod) that is neither vendored nor downloadable, or referencing a module path that does not resolve to any Go module. Surfaced during module collection at the start of a build.","commonSituations":"A theme/module path typo, a module not yet published, a missing `go mod download` for a local replace, or vendoring that omitted the module from _vendor/modules.txt.","solutions":["Verify the module path is correct and the module exists (check the upstream repo / proxy).","Run `hugo mod get <path>` (or `go mod download`) to fetch it explicitly.","If vendoring, ensure _vendor/modules.txt lists the module and its files are present.","For local development, add a replace directive pointing at the local checkout."],"exampleFix":"// before\n[[module.imports]]\npath = \"github.com/x/mising-theme\"\n// after\npath = \"github.com/x/missing-theme\"","handlingStrategy":"validation","validationCode":"// Resolve the module before relying on it.\n// hugo mod get -- <path>  (or go mod download <path>)","typeGuard":null,"tryCatchPattern":"// Distinguish missing-module from other collection errors.\n// if errors.Is(err, modules.ErrNotExist) { /* fetch or remove import */ }","preventionTips":["Run hugo mod get to fetch declared imports.","Keep vendored modules in sync with _vendor/modules.txt.","Use replace directives for local module development."],"tags":["modules","config","dependency"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}