siyuan-note/siyuan · warning

The current settings do not allow the creation of sub-docume

Error message

The current settings do not allow the creation of sub-documents under a document 7 levels deep

What it means

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.

Source

Thrown at kernel/model/file.go:1712

		}
	}

	if 1 == len(fromPaths) {
		// 移动到自己的父文档下的情况相当于不移动,直接返回
		if fromBox := pathsBoxes[fromPaths[0]]; nil != fromBox && fromBox.ID == toBoxID {
			parentDir := path.Dir(fromPaths[0])
			if ("/" == toPath && "/" == parentDir) || (parentDir+".sy" == toPath) {
				return
			}
		}
	}

	// 检查路径深度是否超过限制
	for _, fromPath := range fromPaths {
		fromBox := pathsBoxes[fromPath]
		childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBox.ID, fromPath))
		if depth := strings.Count(toPath, "/") + childDepth; 6 < depth && !Conf.FileTree.AllowCreateDeeper {
			err = errors.New(Conf.Language(118))
			return
		}
	}

	// 禁止跨加密边界移动文档:加密笔记本是孤岛,不同加密笔记本各有独立 DEK,
	// 跨边界移动(普通↔加密、加密 A↔加密 B)会导致密文用错 DEK 损坏数据
	for _, fromPath := range fromPaths {
		fromBox := pathsBoxes[fromPath]
		if fromBox.ID != toBox.ID && !IsSameCryptoBoundary(fromBox.ID, toBox.ID) {
			err = errors.New(Conf.Language(313))
			return
		}
	}

	// A progress layer appears when moving more than 64 documents at once https://github.com/siyuan-note/siyuan/issues/9356
	subDocsCount := 0
	for _, fromPath := range fromPaths {
		fromBox := pathsBoxes[fromPath]

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Enable 'Allow creating sub-documents deeper than 7 levels' in Settings - File tree if deep hierarchies are intentional.
  2. Move the document to a shallower target path to stay within the 6-level limit.
  3. Flatten the source document's child hierarchy before moving.
  4. For programmatic moves, compute the resulting depth beforehand using util.GetChildDocDepth and strings.Count(toPath, "/").

Example fix

// before
err := model.MoveDocs(fromPaths, toBoxID, toPath, callback)

// after
// Pre-check depth before attempting the move
childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBoxID, fromPath))
if depth := strings.Count(toPath, "/") + childDepth; depth > 6 && !conf.Conf.FileTree.AllowCreateDeeper {
    return errors.New("move would exceed depth limit")
}
err := model.MoveDocs(fromPaths, toBoxID, toPath, callback)
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: verify depth won't exceed the limit
for _, fp := range fromPaths {
    box := pathsBoxes[fp]
    if box == nil {
        continue
    }
    childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, box.ID, fp))
    if depth := strings.Count(toPath, "/") + childDepth; depth > 6 && !conf.Conf.FileTree.AllowCreateDeeper {
        return fmt.Errorf("move would place document %s at depth %d (limit: 6)", fp, depth)
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/1a94f4d149ea5d84. Report an issue: GitHub.