{"record":{"id":"4fd6f3931508940b","repo":"gohugoio/hugo","slug":"jekyllroot-is-not-a-directory","errorCode":null,"errorMessage":"{jekyllRoot} is not a directory","messagePattern":"(.+?) is not a directory","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/import.go","lineNumber":350,"sourceCode":"\t\treturn fmt.Errorf(\"failed to convert content for file %q: %s\", filename, err)\n\t}\n\n\tfs := hugofs.Os\n\tif err := helpers.WriteToDisk(targetFile, strings.NewReader(content), fs); err != nil {\n\t\treturn fmt.Errorf(\"failed to save file %q: %s\", filename, err)\n\t}\n\treturn nil\n}\n\nfunc (c *importCommand) copyJekyllFilesAndFolders(jekyllRoot, dest string, jekyllPostDirs map[string]bool) (err error) {\n\tfs := hugofs.Os\n\n\tfi, err := fs.Stat(jekyllRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !fi.IsDir() {\n\t\treturn errors.New(jekyllRoot + \" is not a directory\")\n\t}\n\terr = os.MkdirAll(dest, fi.Mode())\n\tif err != nil {\n\t\treturn err\n\t}\n\tentries, err := os.ReadDir(jekyllRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, entry := range entries {\n\t\tsfp := filepath.Join(jekyllRoot, entry.Name())\n\t\tdfp := filepath.Join(dest, entry.Name())\n\t\tif entry.IsDir() {\n\t\t\tif entry.Name()[0] != '_' && entry.Name()[0] != '.' {\n\t\t\t\tif _, ok := jekyllPostDirs[entry.Name()]; !ok {\n\t\t\t\t\terr = hugio.CopyDir(fs, sfp, dfp, nil)\n\t\t\t\t\tif err != nil {","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/commands/import.go#L332-L368","documentation":"In copyJekyllFilesAndFolders, after os.Stat on jekyllRoot, if it is not a directory the import fails because it expects to walk a Jekyll site root directory (import.go:345-351).","triggerScenarios":"`hugo import jekyll <root> <target>` where <root> is a file path, not a directory.","commonSituations":"Passing a path to _config.yml or a file instead of the Jekyll site root; a broken symlink at the root.","solutions":["Point the first argument at the Jekyll site root directory (the folder containing _posts and _config.yml)","Verify with `ls <root>` that it is a directory","Resolve symlinks before passing the path"],"exampleFix":"# before\nhugo import jekyll ~/blog/_config.yml ./out\n# after\nhugo import jekyll ~/blog ./out","handlingStrategy":"validation","validationCode":"fi, err := os.Stat(root)\nif err != nil || !fi.IsDir() {\n    return errors.New(\"root must be a directory\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the Jekyll site root directory, never an individual file","Validate the root contains _posts before importing"],"tags":["import","jekyll","filesystem","go","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}