{"record":{"id":"b43fa45657facd82","repo":"siyuan-note/siyuan","slug":"localized-message-from-conf-language-6-formatted-with-box","errorCode":null,"errorMessage":"localized message from Conf.Language(6) formatted with box.Name, path, err (mkdir failed)","messagePattern":"localized message from Conf\\.Language\\(6\\) formatted with box\\.Name, path, err \\(mkdir failed\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/box.go","lineNumber":491,"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":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/box.go#L473-L509","documentation":"Box.Mkdir creates a directory inside a notebook after validating the path. On os.Mkdir failure it formats a localized user-facing message from Conf.Language(6) with the box name, path, and OS error, logs the technical detail, and returns that message as the error. The error text is locale-dependent, not a fixed string.","triggerScenarios":"Calling Box.Mkdir(path) (exposed via document-tree 'new folder') when the OS mkdir fails: name conflicts (folder already exists), invalid characters, read-only volume, or permission denied; path must first pass validateBoxPath (no '..' or absolute paths).","commonSituations":"Creating a folder whose name already exists or contains illegal characters on Windows (\\/:*?\"<>|); creating a folder inside a notebook on a disconnected external drive; cloud-sync placeholder files blocking creation.","solutions":["Pick a different folder name that does not already exist in the target path","Remove characters illegal on your OS from the folder name","Ensure the workspace data directory is writable and the volume is mounted","Read the kernel log line 'mkdir [path=...] in box [...] failed' for the underlying OS error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Go: pre-validate name and existence before Mkdir\nif _, err := box.validateBoxPath(path); err != nil {\n    return err\n}\nif util.IsExist(filepath.Join(util.DataDir, box.ID, path)) {\n    return errors.New(\"path already exists\")\n}","typeGuard":null,"tryCatchPattern":"if err := box.Mkdir(path); err != nil {\n    // err is a localized message; details in kernel log 'mkdir [path=...] failed'\n    showDialog(err.Error())\n}","preventionTips":["Use OS-legal folder names (no \\/:*?\"<>| on Windows)","Check for existing names before creating","Keep the data volume mounted and writable"],"tags":["go","filesystem","mkdir","localized-error"],"backgroundTag":"mkdir-permission-denied","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"}