{"record":{"id":"3cf154177c8275f1","repo":"siyuan-note/siyuan","slug":"localized-message-from-conf-language-5-formatted-with-box","errorCode":null,"errorMessage":"localized message from Conf.Language(5) formatted with box.Name, fromPath, err (move failed)","messagePattern":"localized message from Conf\\.Language\\(5\\) formatted with box\\.Name, fromPath, err \\(move failed\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/box.go","lineNumber":524,"sourceCode":"\tIncSync()\n\treturn nil\n}\n\nfunc (box *Box) Move(oldPath, newPath string) error {\n\tif _, err := box.validateBoxPath(oldPath); err != nil {\n\t\treturn err\n\t}\n\tif _, err := box.validateBoxPath(newPath); err != nil {\n\t\treturn err\n\t}\n\tboxLocalPath := filepath.Join(util.DataDir, box.ID)\n\tfromPath := filepath.Join(boxLocalPath, oldPath)\n\ttoPath := filepath.Join(boxLocalPath, newPath)\n\n\tif err := filelock.Rename(fromPath, toPath); err != nil {\n\t\tmsg := fmt.Sprintf(Conf.Language(5), box.Name, fromPath, err)\n\t\tlogging.LogErrorf(\"move [path=%s] in box [%s] failed: %s\", fromPath, box.Name, err)\n\t\treturn errors.New(msg)\n\t}\n\n\tif oldDir := path.Dir(oldPath); ast.IsNodeIDPattern(path.Base(oldDir)) {\n\t\tfromDir := filepath.Join(boxLocalPath, oldDir)\n\t\tif util.IsEmptyDir(fromDir) {\n\t\t\tfilelock.Remove(fromDir)\n\t\t}\n\t}\n\tIncSync()\n\treturn nil\n}\n\nfunc (box *Box) Remove(path string) error {\n\tif _, err := box.validateBoxPath(path); err != nil {\n\t\treturn err\n\t}\n\tboxLocalPath := filepath.Join(util.DataDir, box.ID)\n\tfilePath := filepath.Join(boxLocalPath, path)","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/box.go#L506-L542","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure no other SiYuan instance or sync client is locking files in the workspace","Choose a target name/path that does not already exist","Refresh the document tree and retry — the source may have been removed externally","Check the kernel log for 'move [path=...] failed' to see the exact OS error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Go: verify source exists and destination is free\nfrom := filepath.Join(util.DataDir, box.ID, oldPath)\nto := filepath.Join(util.DataDir, box.ID, newPath)\nif !util.IsExist(from) { return errors.New(\"source missing\") }\nif util.IsExist(to) { return errors.New(\"destination exists\") }","typeGuard":null,"tryCatchPattern":"if err := box.Move(oldPath, newPath); err != nil {\n    // localized message; underlying OS error in kernel log 'move [path=...] failed'\n    return err\n}","preventionTips":["Run only one SiYuan instance per workspace","Exclude the workspace from aggressive file-locking sync tools","Refresh the tree after external changes before moving"],"tags":["go","filesystem","rename","document-move"],"backgroundTag":"file-rename-failed","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}