siyuan-note/siyuan · error

localized message from Conf.Language(5) formatted with…

Error message

localized message from Conf.Language(5) formatted with box.Name, fromPath, err (move failed)

What it means

Box.Move renames a path inside a notebook via filelock.Rename. On failure it formats a localized user-facing message from Conf.Language(5) with box name, source path, and OS error, logs the technical detail, and returns the message. Reached by moveDoc when dragging documents in the tree.

Solutions

  1. Ensure no other SiYuan instance or sync client is locking files in the workspace
  2. Choose a target name/path that does not already exist
  3. Refresh the document tree and retry — the source may have been removed externally
  4. Check the kernel log for 'move [path=...] failed' to see the exact OS error
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: verify source exists and destination is free
from := filepath.Join(util.DataDir, box.ID, oldPath)
to := filepath.Join(util.DataDir, box.ID, newPath)
if !util.IsExist(from) { return errors.New("source missing") }
if util.IsExist(to) { return errors.New("destination exists") }

Try / catch

if err := box.Move(oldPath, newPath); err != nil {
    // localized message; underlying OS error in kernel log 'move [path=...] failed'
    return err
}

Prevention

When it happens

Trigger: Calling Box.Move(oldPath, newPath) (or moving a document in the UI) when rename fails: destination already exists, source missing, cross-device rename (source and target on different filesystems is prevented by design since both are inside the box), or lock held by another process.

Common situations: Two SiYuan instances open on the same workspace; sync client temporarily holding the file; destination document name already taken; source document deleted externally just before the move.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/3cf154177c8275f1. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/box.go:524

	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)
		logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, box.Name, err)
		return errors.New(msg)
	}

	if oldDir := path.Dir(oldPath); ast.IsNodeIDPattern(path.Base(oldDir)) {
		fromDir := filepath.Join(boxLocalPath, oldDir)
		if util.IsEmptyDir(fromDir) {
			filelock.Remove(fromDir)
		}
	}
	IncSync()
	return nil
}

func (box *Box) Remove(path string) error {
	if _, err := box.validateBoxPath(path); err != nil {
		return err
	}
	boxLocalPath := filepath.Join(util.DataDir, box.ID)
	filePath := filepath.Join(boxLocalPath, path)

View on GitHub (pinned to 9f775e8a12)