{"record":{"id":"1a94f4d149ea5d84","repo":"siyuan-note/siyuan","slug":"the-current-settings-do-not-allow-the-creation-of","errorCode":null,"errorMessage":"The current settings do not allow the creation of sub-documents under a document 7 levels deep","messagePattern":"The current settings do not allow the creation of sub-documents under a document 7 levels deep","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/file.go","lineNumber":1776,"sourceCode":"\t\t}\n\t}\n\n\tif 1 == len(fromPaths) {\n\t\t// 移动到自己的父文档下的情况相当于不移动，直接返回\n\t\tif fromBox := pathsBoxes[fromPaths[0]]; nil != fromBox && fromBox.ID == toBoxID {\n\t\t\tparentDir := path.Dir(fromPaths[0])\n\t\t\tif (\"/\" == toPath && \"/\" == parentDir) || (parentDir+\".sy\" == toPath) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// 检查路径深度是否超过限制\n\tfor _, fromPath := range fromPaths {\n\t\tfromBox := pathsBoxes[fromPath]\n\t\tchildDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBox.ID, fromPath))\n\t\tif depth := strings.Count(toPath, \"/\") + childDepth; 6 < depth && !Conf.FileTree.AllowCreateDeeper {\n\t\t\terr = errors.New(Conf.Language(118))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// 禁止跨加密边界移动文档：加密笔记本是孤岛，不同加密笔记本各有独立 DEK，\n\t// 跨边界移动（普通↔加密、加密 A↔加密 B）会导致密文用错 DEK 损坏数据\n\tfor _, fromPath := range fromPaths {\n\t\tfromBox := pathsBoxes[fromPath]\n\t\tif fromBox.ID != toBox.ID && !IsSameCryptoBoundary(fromBox.ID, toBox.ID) {\n\t\t\terr = errors.New(Conf.Language(313))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// A progress layer appears when moving more than 64 documents at once https://github.com/siyuan-note/siyuan/issues/9356\n\tsubDocsCount := 0\n\tfor _, fromPath := range fromPaths {\n\t\tfromBox := pathsBoxes[fromPath]","sourceCodeStart":1758,"sourceCodeEnd":1794,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/file.go#L1758-L1794","documentation":"Thrown by MoveDocs (kernel/model/file.go:1776) during the depth pre-check. For each moved path it computes childDepth = util.GetChildDocDepth() (the deepest descendant level relative to the moved doc, scanned on disk) and adds strings.Count(toPath, \"/\") (the target's level). If the sum exceeds 6 and the setting Conf.FileTree.AllowCreateDeeper is false, the move aborts with Conf.Language(118) — the resulting hierarchy would place sub-documents more than 7 levels deep. This mirrors the create-time limit and exists because deep trees degrade listing and indexing performance.","triggerScenarios":"POST /api/filetree/moveDocs that drops a document which has descendants (e.g. a 4-level subtree) under a parent already at level 5+, so target depth + subtree depth > 6; always fires before any file operation, so nothing is moved. Conf.FileTree.AllowCreateDeeper (Settings - Filetree - \"Allow creation of sub-documents deeper than 7 levels\") being disabled is the enabling condition.","commonSituations":"Reorganizing a deep knowledge base by dragging whole branches toward the bottom of the tree; importing structured content then trying to nest it; orgs that disabled the deep-hierarchy toggle to keep trees flat.","solutions":["Enable 设置 - 文档树 - 允许创建深度超过 7 层的子文档 (Settings - Filetree - Allow creation of sub-documents deeper than 7 levels), then retry the move","Move the branch to a shallower target (closer to the notebook root) so targetDepth + subtreeDepth <= 6","Split the move: relocate ancestors first, or move deep sub-trees independently to keep each resulting depth within the limit","For API callers, read the setting via /api/setting/getFileTree and warn the user before attempting a deep move"],"exampleFix":"// before\nfetchPost('/api/filetree/moveDocs', {fromPaths: [deepBranch], toNotebook, toPath: level6ParentPath}) // 400: 7-level limit\n\n// after\n// either raise the target or lift the limit\nconst conf = await fetchSyncPost('/api/setting/getFileTree', {})\nif (!conf.data.fileTree.allowCreateDeeper) {\n  await fetchSyncPost('/api/setting/setFileTree', {fileTree: {...conf.data.fileTree, allowCreateDeeper: true}})\n}\nfetchPost('/api/filetree/moveDocs', {fromPaths: [deepBranch], toNotebook, toPath: level6ParentPath})","handlingStrategy":"validation","validationCode":"// Pre-check the move depth budget like the kernel does (file.go:1772-1778)\nfunc moveDepthOK(fromBoxID, fromPath, toPath string) bool {\n\tif Conf.FileTree.AllowCreateDeeper {\n\t\treturn true\n\t}\n\tchildDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBoxID, fromPath))\n\treturn strings.Count(toPath, \"/\")+childDepth <= 6\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Expose and honor the allowCreateDeeper setting in your tooling; warn before deep moves instead of failing mid-batch","When reorganizing, move branches upward (toward root) rather than deeper to stay within budget","Remember the budget counts the subtree's deepest child, not just the dragged doc"],"tags":["siyuan","filetree","depth-limit","move-docs","configuration"],"backgroundTag":"hierarchy-depth-limit-exceeded","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}