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

What it means

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.

Solutions

  1. Pick a different folder name that does not already exist in the target path
  2. Remove characters illegal on your OS from the folder name
  3. Ensure the workspace data directory is writable and the volume is mounted
  4. Read the kernel log line 'mkdir [path=...] in box [...] failed' for the underlying OS error
Defensive patterns

Strategy: validation

Validate before calling

// Go: pre-validate name and existence before Mkdir
if _, err := box.validateBoxPath(path); err != nil {
    return err
}
if util.IsExist(filepath.Join(util.DataDir, box.ID, path)) {
    return errors.New("path already exists")
}

Try / catch

if err := box.Mkdir(path); err != nil {
    // err is a localized message; details in kernel log 'mkdir [path=...] failed'
    showDialog(err.Error())
}

Prevention

When it happens

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

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

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@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/b43fa45657facd82. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/box.go:491

	}
	return
}

func (box *Box) Exist(p string) bool {
	if _, err := box.validateBoxPath(p); err != nil {
		return false
	}
	return filelock.IsExist(filepath.Join(util.DataDir, box.ID, p))
}

func (box *Box) Mkdir(path string) error {
	if _, err := box.validateBoxPath(path); err != nil {
		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
}

View on GitHub (pinned to 9f775e8a12)