{"record":{"id":"51d9db8565ce156f","repo":"siyuan-note/siyuan","slug":"user-guide-path-is-not-a-directory-s","errorCode":null,"errorMessage":"user guide path is not a directory: %s","messagePattern":"user guide path is not a directory: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/mount.go","lineNumber":635,"sourceCode":"\t\tavFiles, err := getUserGuideAVJSONFiles(boxID)\n\t\tif nil != err {\n\t\t\treturn nil, err\n\t\t}\n\t\tret = append(ret, avFiles...)\n\t}\n\treturn\n}\n\nfunc readUserGuideDirectory(dir string) ([]os.DirEntry, error) {\n\tinfo, err := os.Stat(dir)\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !info.IsDir() {\n\t\treturn nil, fmt.Errorf(\"user guide path is not a directory: %s\", dir)\n\t}\n\treturn os.ReadDir(dir)\n}\n","sourceCodeStart":617,"sourceCodeEnd":639,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/mount.go#L617-L639","documentation":"readUserGuideDirectory stats a user-guide directory before calling os.ReadDir. If the path exists but is a regular file (or other non-directory), it returns 'user guide path is not a directory: %s' instead of attempting ReadDir on a file. Callers getUserGuideAVJSONFiles and getAllUserGuideAVJSONFiles propagate the error while collecting attribute-view JSON files from user-guide notebooks.","triggerScenarios":"os.Stat(dir) succeeds but info.IsDir() is false — i.e. a path expected to be a guide directory (e.g. under data/ for a user-guide notebook ID) exists as a plain file. Happens in readUserGuideDirectory invoked via getUserGuideAVJSONFiles or getAllUserGuideAVJSONFiles.","commonSituations":"A file was created where the guide notebook's storage directory should be (e.g. a stray file named like the guide box ID or its storage subpath), a partially-removed/recreated guide notebook left a file placeholder, or a custom/conf path points to a file instead of a directory.","solutions":["Delete or rename the offending file at the path printed in the error so the user-guide directory can be created/read","Reopen or re-sync the workspace so missing user-guide folders are regenerated","If a custom workspace/data path was misconfigured, correct it to point at the actual data directory","Check disk/filesystem state for partial sync or copy operations that replaced the directory with a file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if info, err := os.Stat(dir); err == nil && !info.IsDir() {\n    // skip guide scan: path exists but is not a directory\n}\n","typeGuard":"func isDir(p string) bool { info, err := os.Stat(p); return err == nil && info.IsDir() }\n","tryCatchPattern":null,"preventionTips":["Never create files whose names collide with user-guide notebook directory paths under data/","After interrupted sync/copy operations, verify expected guide directories are directories, not files","When moving workspaces, copy directory trees preserving structure"],"tags":["filesystem","user-guide","mount"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}