{"record":{"id":"830b4527b3dad98d","repo":"gohugoio/hugo","slug":"failed-to-walk-archetype-dir-q-w","errorCode":null,"errorMessage":"failed to walk archetype dir %q: %w","messagePattern":"failed to walk archetype dir %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"create/content.go","lineNumber":338,"sourceCode":"\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tm.otherFiles = append(m.otherFiles, fim)\n\n\t\treturn nil\n\t}\n\n\twalkCfg := hugofs.WalkwayConfig{\n\t\tWalkFn: walkFn,\n\t\tFs:     b.archeTypeFs,\n\t\tRoot:   filepath.FromSlash(b.archetypeFi.Meta().PathInfo.Path()),\n\t}\n\n\tw := hugofs.NewWalkway(walkCfg)\n\n\tif err := w.Walk(); err != nil {\n\t\treturn fmt.Errorf(\"failed to walk archetype dir %q: %w\", b.archetypeFi.Meta().Filename, err)\n\t}\n\n\tb.dirMap = m\n\n\treturn nil\n}\n\nfunc (b *contentBuilder) openInEditorIfConfigured(filename string) error {\n\teditor := b.h.Conf.NewContentEditor()\n\tif editor == \"\" {\n\t\treturn nil\n\t}\n\n\teditorExec := strings.Fields(editor)[0]\n\teditorFlags := strings.Fields(editor)[1:]\n\n\tvar args []any\n\tfor _, editorFlag := range editorFlags {","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/create/content.go#L320-L356","documentation":"When the archetype is a directory, contentBuilder.mapArcheTypeDir walks it via hugofs.NewWalkway (create/content.go:335). This wraps any error returned by the walk, e.g. an unreadable entry, a symlink loop, or an FS-level error inside the archetype tree.","triggerScenarios":"The archetype directory contains an unreadable file/subdir, a symlink that loops, or a virtual mount whose backing path is missing; the walk closure returns a non-nil error for one of the entries.","commonSituations":"Symlink loop inside archetypes/; archetype directory on a flaky mount; archetype copied from a different OS with case-collision filenames.","solutions":["Scan the archetype directory for permission issues, symlink loops, and broken links, then fix them.","Simplify the directory archetype to a minimal tree and re-add entries to isolate the failing one.","Ensure the archetypes/ path is on a healthy, readable filesystem."],"exampleFix":"# before: archetypes/default/ contains a self-referential symlink\nln -s . archetypes/default/loop\n\n# after: remove the loop\n$ rm archetypes/default/loop","handlingStrategy":"validation","validationCode":"// Walk the archetype directory ahead of time to surface FS issues early.\nfunc ValidateArchetypeDir(fs afero.Fs, root string) error {\n    return afero.Walk(fs, root, func(p string, info os.FileInfo, err error) error {\n        return err // any walk error propagates\n    })\n}","typeGuard":null,"tryCatchPattern":"if err := create.NewContent(h, kind, targetPath, force); err != nil {\n    return err\n}","preventionTips":["Keep archetype directories free of symlink loops and unreadable entries.","Place archetypes/ on a healthy local filesystem.","Audit archetype trees after copying from other projects."],"tags":["archetype","filesystem","walk"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}