{"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":"warning","filePath":"kernel/model/file.go","lineNumber":1712,"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":1694,"sourceCodeEnd":1730,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/file.go#L1694-L1730","documentation":"Thrown by MoveDocs when moving a document would place it more than 6 levels deep (depth > 6) and the setting Conf.FileTree.AllowCreateDeeper is false. Conf.Language(118) = 'The current settings do not allow the creation of sub-documents under a document 7 levels deep'. Depth is computed as the number of '/' in toPath plus the child document depth of the source. This prevents excessively deep hierarchies that degrade performance.","triggerScenarios":"Calling MoveDocs with a toPath that, combined with the source document's existing child depth, exceeds 6 levels. For example, moving a document that itself has children into a deeply nested target. The guard iterates all fromPaths and checks each against the depth formula: strings.Count(toPath, \"/\") + childDepth.","commonSituations":"A user drags a sub-tree into an already deeply nested location. The depth setting was tightened from the default. A batch move includes documents with different child depths, and at least one exceeds the limit.","solutions":["Enable 'Allow creating sub-documents deeper than 7 levels' in Settings - File tree if deep hierarchies are intentional.","Move the document to a shallower target path to stay within the 6-level limit.","Flatten the source document's child hierarchy before moving.","For programmatic moves, compute the resulting depth beforehand using util.GetChildDocDepth and strings.Count(toPath, \"/\")."],"exampleFix":"// before\nerr := model.MoveDocs(fromPaths, toBoxID, toPath, callback)\n\n// after\n// Pre-check depth before attempting the move\nchildDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBoxID, fromPath))\nif depth := strings.Count(toPath, \"/\") + childDepth; depth > 6 && !conf.Conf.FileTree.AllowCreateDeeper {\n    return errors.New(\"move would exceed depth limit\")\n}\nerr := model.MoveDocs(fromPaths, toBoxID, toPath, callback)","handlingStrategy":"validation","validationCode":"// Pre-check: verify depth won't exceed the limit\nfor _, fp := range fromPaths {\n    box := pathsBoxes[fp]\n    if box == nil {\n        continue\n    }\n    childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, box.ID, fp))\n    if depth := strings.Count(toPath, \"/\") + childDepth; depth > 6 && !conf.Conf.FileTree.AllowCreateDeeper {\n        return fmt.Errorf(\"move would place document %s at depth %d (limit: 6)\", fp, depth)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute the resulting depth (toPath slashes + child depth) before calling MoveDocs.","Enable AllowCreateDeeper in settings if deep hierarchies are intentional.","Move documents to shallower targets when depth would exceed the limit."],"tags":["move","depth-limit","configuration","file-tree"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}