{"record":{"id":"f431e5ff21617127","repo":"gohugoio/hugo","slug":"module-workspace-q-does-not-exist-check-your-mod","errorCode":null,"errorMessage":"module workspace %q does not exist. Check your module.workspace setting (or HUGO_MODULE_WORKSPACE env var).","messagePattern":"module workspace %q does not exist\\. Check your module\\.workspace setting \\(or HUGO_MODULE_WORKSPACE env var\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/config.go","lineNumber":249,"sourceCode":"\t\t\tmnt.Target = filepath.Clean(mnt.Target)\n\t\t\tif err := mnt.init(logger); err != nil {\n\t\t\t\treturn c, fmt.Errorf(\"failed to init mount %d: %w\", i, err)\n\t\t\t}\n\t\t\tc.Mounts[i] = mnt\n\t\t}\n\n\t\tif c.Workspace == \"\" {\n\t\t\tc.Workspace = WorkspaceDisabled\n\t\t}\n\t\tif c.Workspace != WorkspaceDisabled {\n\t\t\tc.Workspace = filepath.Clean(c.Workspace)\n\t\t\tif !filepath.IsAbs(c.Workspace) {\n\t\t\t\tworkingDir := cfg.GetString(\"workingDir\")\n\t\t\t\tc.Workspace = filepath.Join(workingDir, c.Workspace)\n\t\t\t}\n\t\t\tif _, err := os.Stat(c.Workspace); err != nil {\n\t\t\t\t//lint:ignore ST1005 end user message.\n\t\t\t\treturn c, fmt.Errorf(\"module workspace %q does not exist. Check your module.workspace setting (or HUGO_MODULE_WORKSPACE env var).\", c.Workspace)\n\t\t\t}\n\t\t}\n\t}\n\n\tif themeSet {\n\t\timports := config.GetStringSlicePreserveString(cfg, \"theme\")\n\t\tfor _, imp := range imports {\n\t\t\tc.Imports = append(c.Imports, Import{\n\t\t\t\tPath: imp,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn c, nil\n}\n\n// Config holds a module config.\ntype Config struct {","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/modules/config.go#L231-L267","documentation":"From decodeConfig (modules/config.go:249). After cleaning the module.workspace value (resolved relative to workingDir if not absolute) and unless it equals WorkspaceDisabled, Hugo stats the path; if os.Stat fails the build aborts. The message points the user to both the module.workspace setting and HUGO_MODULE_WORKSPACE.","triggerScenarios":"module.workspace (or HUGO_MODULE_WORKSPACE) is set to a path that does not exist on disk; the workspace file was deleted/moved; a relative path resolved against an unexpected workingDir.","commonSituations":"Checking out a repo whose go.work file is gitignored or not committed; CI running from a different workingDir than expected; pointing to a workspace file under a submodule that wasn't initialized; typo in the path.","solutions":["Create the go.work file (e.g. 'go work init' / 'go work use ./...') at the configured path, or correct the path.","If you do not need a workspace, set module.workspace = 'off' (WorkspaceDisabled) or unset HUGO_MODULE_WORKSPACE.","Ensure the path is absolute or correctly relative to the Hugo workingDir."],"exampleFix":"// before\n[module]\nworkspace = \"hugo.work\"\n// hugo.work missing -> error\n\n// after\n[module]\nworkspace = \"off\"\n// or: create hugo.work with `go work init`","handlingStrategy":"validation","validationCode":"ws := cfg.Module.Workspace\nif ws != \"\" && ws != \"off\" {\n    if !filepath.IsAbs(ws) {\n        ws = filepath.Join(workDir, ws)\n    }\n    if _, err := os.Stat(ws); err != nil {\n        return fmt.Errorf(\"workspace %q missing: %w\", ws, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit go.work if the build needs it, or set workspace = \"off\".","Use absolute paths in CI to avoid workingDir ambiguity.","Initialize the workspace with 'go work init' before building."],"tags":["hugo","module-workspace","configuration"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}