siyuan-note/siyuan · error
localized message from Conf.Language(6) formatted with…
Error message
localized message from Conf.Language(6) formatted with box.Name, path, err (mkdir all failed)
What it means
Box.MkdirAll creates a directory tree inside a notebook. On os.MkdirAll failure it formats a localized message via Conf.Language(6) with box name, path, and the OS error, logs the detail, and returns the message. Called internally by moveDoc when recreating destination directories during a document move.
Solutions
- Verify no file exists with the same name as an intermediate path segment
- Ensure the notebook directory is writable and the volume mounted
- Shorten the target path on Windows or enable long-path support
- Check the kernel log for the 'mkdir all [path=...] failed' entry to get the exact OS error
Defensive patterns
Strategy: validation
Validate before calling
// Go: ensure no intermediate segment is a regular file
for seg := path; seg != "." && seg != "/" && seg != ""; seg = filepath.Dir(seg) {
if util.IsExist(filepath.Join(util.DataDir, box.ID, seg)) &&
!gulu.File.IsDir(filepath.Join(util.DataDir, box.ID, seg)) {
return fmt.Errorf("%s is a file, not a directory", seg)
}
} Try / catch
if err := box.MkdirAll(path); err != nil {
// localized message; see kernel log 'mkdir all [path=...] failed'
return err
} Prevention
- Keep path segments free of illegal characters
- Avoid very deep/long paths on Windows
- Ensure intermediate names are not used by files
When it happens
Trigger: Calling Box.MkdirAll(path) (also reached by moving a document whose target directory does not exist) when the OS mkdir -p fails: permission denied, path component is a file, read-only volume, or illegal characters in a path segment.
Common situations: moveDoc targeting a path where an intermediate segment exists as a file; restoring a notebook onto a read-only disk; long-path limits on Windows exceeding MAX_PATH.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- create import dir failed:
- errors.New(msg) with Conf.Language(6) template: mkdir all…
- localized message from Conf.Language(5) formatted with…
- localized message from Conf.Language(6) formatted with…
- mkdir box conf dir failed
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/163197117889130b.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/box.go:504
return err
}
if err := os.Mkdir(filepath.Join(util.DataDir, box.ID, path), 0755); err != nil {
msg := fmt.Sprintf(Conf.Language(6), box.Name, path, err)
logging.LogErrorf("mkdir [path=%s] in box [%s] failed: %s", path, box.ID, err)
return errors.New(msg)
}
IncSync()
return nil
}
func (box *Box) MkdirAll(path string) error {
if _, err := box.validateBoxPath(path); err != nil {
return err
}
if err := os.MkdirAll(filepath.Join(util.DataDir, box.ID, path), 0755); err != nil {
msg := fmt.Sprintf(Conf.Language(6), box.Name, path, err)
logging.LogErrorf("mkdir all [path=%s] in box [%s] failed: %s", path, box.ID, err)
return errors.New(msg)
}
IncSync()
return nil
}
func (box *Box) Move(oldPath, newPath string) error {
if _, err := box.validateBoxPath(oldPath); err != nil {
return err
}
if _, err := box.validateBoxPath(newPath); err != nil {
return err
}
boxLocalPath := filepath.Join(util.DataDir, box.ID)
fromPath := filepath.Join(boxLocalPath, oldPath)
toPath := filepath.Join(boxLocalPath, newPath)
if err := filelock.Rename(fromPath, toPath); err != nil {
msg := fmt.Sprintf(Conf.Language(5), box.Name, fromPath, err)View on GitHub (pinned to 9f775e8a12)