{"record":{"id":"7e9eddb149a1a63b","repo":"siyuan-note/siyuan","slug":"errors-new-msg-with-conf-language-6-template-mk","errorCode":null,"errorMessage":"errors.New(msg) with Conf.Language(6) template: mkdir failure message shown to user","messagePattern":"errors\\.New\\(msg\\) with Conf\\.Language\\(6\\) template: mkdir failure message shown to user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/box.go","lineNumber":487,"sourceCode":"\t}\n\treturn\n}\n\nfunc (box *Box) Exist(p string) bool {\n\tif _, err := box.validateBoxPath(p); err != nil {\n\t\treturn false\n\t}\n\treturn filelock.IsExist(filepath.Join(util.DataDir, box.ID, p))\n}\n\nfunc (box *Box) Mkdir(path string) error {\n\tif _, err := box.validateBoxPath(path); err != nil {\n\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","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/box.go#L469-L505","documentation":"Box.Mkdir creates a directory inside a notebook. On os.Mkdir failure it formats the localized template Conf.Language(6) with box name, path and the OS error, and returns it as the error. This is a user-facing message, not a typed error.","triggerScenarios":"Creating a document/folder when the target parent directory does not exist, lacks write permission, or the name collides with an existing file — after validateBoxPath passes.","commonSituations":"Notebook directory deleted externally while the UI still lists it; workspace on a read-only volume; filename with characters the OS rejects (e.g. ':' on Windows).","solutions":["Read the OS error embedded in the message (path and reason are included)","Verify <DataDir>/<boxID> exists and is writable","Check the requested path for invalid characters for your OS","Rebuild/reopen the notebook so the kernel refreshes its state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(filepath.Join(util.DataDir, box.ID, parentOf(path))); err != nil { return errors.New(\"parent directory missing\") }","typeGuard":null,"tryCatchPattern":"if err := box.Mkdir(path); err != nil { showErrorToUser(err.Error()) } // message is already localized and user-facing","preventionTips":["Keep notebook directories intact between operations","Avoid OS-invalid filename characters","Refresh notebook state after external changes"],"tags":["filesystem","mkdir","user-facing"],"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-14T00:17:10.932Z"}