siyuan-note/siyuan · error
msg = fmt.Sprintf(Conf.Language(5), fromBox.Name, fromPath,
Error message
msg = fmt.Sprintf(Conf.Language(5), fromBox.Name, fromPath, err)
What it means
In MoveDocs (kernel/model/file.go:1891), after resolving a name conflict the kernel renames the source .sy file via filelock.Rename. If the OS rename fails (the failed path is first removed at absToPath then the rename is retried), the error is wrapped with localized kernel message 5: 'Move notebook [%s] file [%s] failed: %s'. This is a filesystem-level failure, not a validation error.
Source
Thrown at kernel/model/file.go:1891
needMoveSubDocs := fromBox.Exist(fromFolder)
if needMoveSubDocs {
// 移动子文档文件夹
newFolder := path.Join(toFolder, tree.ID)
if isSameBox {
if err = fromBox.Move(fromFolder, newFolder); err != nil {
return
}
} else {
absFromPath := filepath.Join(util.DataDir, fromBox.ID, fromFolder)
absToPath := filepath.Join(util.DataDir, toBox.ID, newFolder)
if filelock.IsExist(absToPath) {
filelock.Remove(absToPath)
}
if err = filelock.Rename(absFromPath, absToPath); err != nil {
msg := fmt.Sprintf(Conf.Language(5), fromBox.Name, fromPath, err)
logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, fromBox.ID, err)
err = errors.New(msg)
return
}
}
}
newPath = path.Join(toFolder, tree.ID+".sy")
if isSameBox {
if err = fromBox.Move(fromPath, newPath); err != nil {
return
}
tree, err = filesys.LoadTree(fromBox.ID, newPath, luteEngine)
if err != nil {
return
}
moveTree(tree)View on GitHub (pinned to 8641553a1f)
Solutions
- Read the wrapped OS error in the message and fix the underlying filesystem cause (missing file, permissions, lock).
- Verify the source .sy file exists at data/<boxID>/<fromPath> and that no sync/AV tool is locking it; pause sync tools and retry.
- Check the workspace directory permissions (see kernel message 33) and ensure the destination parent folder is writable.
- If another client concurrently changed the tree, reload the file tree and repeat the move with fresh paths.
Example fix
// before: blind retry into a possibly missing destination dir moveDocs(["/a/doc.sy"], toBoxID, "/missing-parent"); // after: ensure the destination parent doc exists first createDocWithMd(toBoxID, "/missing-parent", "missing-parent", ""); moveDocs(["/a/doc.sy"], toBoxID, "/missing-parent");
Defensive patterns
Strategy: try-catch
Validate before calling
const exists = await fetchPost("/api/filetree/getHPathByID", {id: docID});
if (!exists?.data) throw new Error("source document no longer exists; refresh the tree before moving"); Try / catch
try {
await moveDocs(fromPaths, toBoxID, toPath);
} catch (e) {
const m = String(e.msg);
if (m.includes("Move notebook") && m.includes("failed")) {
logging.warn(`filesystem move failed: ${m}; refreshing tree and retrying once`);
await reloadFiletree();
await moveDocs(fromPaths, toBoxID, toPath);
} else { throw e; }
} Prevention
- Pause third-party sync clients (OneDrive/Dropbox) pointing at the workspace during bulk moves.
- Ensure the workspace folder is user-writable and excluded from antivirus scanning (kernel message 33).
- Refresh the file tree before and after bulk operations so paths are current.
When it happens
Trigger: filelock.Rename(absFromPath, absToPath) returns an error — source file missing, destination directory not yet created, file locked by antivirus/sync tools, permission problems, or cross-device rename issues.
Common situations: The .sy file was deleted or renamed by another client/sync tool between listing and moving; cloud-sync clients (OneDrive/Dropbox) or antivirus holding locks on the file; workspace folder permissions changed; running the kernel without write access to the data dir.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- rollback [%s] to [%s] failed: %w
- move [%s] to [%s] failed: %w
- install local marketplace package failed: %w; rollback faile
- Move notebook [%s] file [%s] failed: %s
- read session file failed: %w
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/b8dc0e1ff6446033.
Report an issue: GitHub.