siyuan-note/siyuan · error

errors.New(msg) with Conf.Language(6) template: mkdir all…

Error message

errors.New(msg) with Conf.Language(6) template: mkdir all failure message shown to user

What it means

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).

Solutions

  1. Inspect the OS error text in the message to find the failing path component
  2. Remove/rename any regular file that occupies an intermediate path component
  3. Fix permissions on the notebook directory
  4. Re-open the workspace after external sync tools finish modifying the data dir
Defensive patterns

Strategy: validation

Validate before calling

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") } }

Try / catch

if err := box.MkdirAll(path); err != nil { showErrorToUser(err.Error()) }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/28d465033fee30fc. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/box.go:500

		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 8641553a1f)