{"record":{"id":"28d465033fee30fc","repo":"siyuan-note/siyuan","slug":"errors-new-msg-with-conf-language-6-template-mk-28d465","errorCode":null,"errorMessage":"errors.New(msg) with Conf.Language(6) template: mkdir all failure message shown to user","messagePattern":"errors\\.New\\(msg\\) with Conf\\.Language\\(6\\) template: mkdir all failure message shown to user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/box.go","lineNumber":500,"sourceCode":"\t\treturn err\n\t}\n\tif err := os.Mkdir(filepath.Join(util.DataDir, box.ID, path), 0755); err != nil {\n\t\tmsg := fmt.Sprintf(Conf.Language(6), box.Name, path, err)\n\t\tlogging.LogErrorf(\"mkdir [path=%s] in box [%s] failed: %s\", path, box.ID, err)\n\t\treturn errors.New(msg)\n\t}\n\tIncSync()\n\treturn nil\n}\n\nfunc (box *Box) MkdirAll(path string) error {\n\tif _, err := box.validateBoxPath(path); err != nil {\n\t\treturn err\n\t}\n\tif err := os.MkdirAll(filepath.Join(util.DataDir, box.ID, path), 0755); err != nil {\n\t\tmsg := fmt.Sprintf(Conf.Language(6), box.Name, path, err)\n\t\tlogging.LogErrorf(\"mkdir all [path=%s] in box [%s] failed: %s\", path, box.ID, err)\n\t\treturn errors.New(msg)\n\t}\n\tIncSync()\n\treturn nil\n}\n\nfunc (box *Box) Move(oldPath, newPath string) error {\n\tif _, err := box.validateBoxPath(oldPath); err != nil {\n\t\treturn err\n\t}\n\tif _, err := box.validateBoxPath(newPath); err != nil {\n\t\treturn err\n\t}\n\tboxLocalPath := filepath.Join(util.DataDir, box.ID)\n\tfromPath := filepath.Join(boxLocalPath, oldPath)\n\ttoPath := filepath.Join(boxLocalPath, newPath)\n\n\tif err := filelock.Rename(fromPath, toPath); err != nil {\n\t\tmsg := fmt.Sprintf(Conf.Language(5), box.Name, fromPath, err)","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/box.go#L482-L518","documentation":"Box.MkdirAll creates nested directories inside a notebook (called from moveDoc when moving documents into a new parent path). On os.MkdirAll failure it formats the localized template Conf.Language(6) and returns errors.New(msg).","triggerScenarios":"moveDoc targeting a destination path whose parent chain cannot be created: permission denied, a path component is a regular file, or the notebook directory is missing.","commonSituations":"Moving docs into a deep path where an intermediate component exists as a file; workspace on read-only storage; notebook removed on disk by an external sync while the app is open.","solutions":["Inspect the OS error text in the message to find the failing path component","Remove/rename any regular file that occupies an intermediate path component","Fix permissions on the notebook directory","Re-open the workspace after external sync tools finish modifying the data dir"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for _, part := range strings.Split(path, \"/\") { if fi, err := os.Stat(filepath.Join(util.DataDir, box.ID, part)); err == nil && !fi.IsDir() { return errors.New(part + \" is a file\") } }","typeGuard":null,"tryCatchPattern":"if err := box.MkdirAll(path); err != nil { showErrorToUser(err.Error()) }","preventionTips":["Ensure no intermediate path component is a regular file","Do not move docs while external sync tools are writing","Verify notebook exists on disk before deep moves"],"tags":["filesystem","mkdir","document-move"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}