AlistGo/alist · error

路径冲突: 路径 '%s' (ID: %s) 与路径 '%s' (ID: %s) 存在层次冲突

Error message

路径冲突: 路径 '%s' (ID: %s) 与路径 '%s' (ID: %s) 存在层次冲突

What it means

The second conflict check in _detectPathConflicts: two different share ids are mounted at paths where one is a directory-ancestor of the other (e.g., 'docs' and 'docs/books'). Nesting distinct shares this way makes path resolution ambiguous, so initialization fails with the colliding pair in the message (Chinese: 'hierarchical conflict').

Source

Thrown at drivers/doubao_share/util.go:288

	}

	for sharePath, ids := range pathToShareIds {
		if len(ids) > 1 {
			return fmt.Errorf("路径冲突: 路径 '%s' 被多个不同的分享ID使用: %s",
				sharePath, strings.Join(ids, ", "))
		}
	}

	// 检查层次冲突
	for path1, id1 := range shareConfigs {
		for path2, id2 := range shareConfigs {
			if path1 == path2 || id1 == id2 {
				continue
			}

			// 检查前缀冲突
			if strings.HasPrefix(path2, path1+"/") || strings.HasPrefix(path1, path2+"/") {
				return fmt.Errorf("路径冲突: 路径 '%s' (ID: %s) 与路径 '%s' (ID: %s) 存在层次冲突",
					path1, id1, path2, id2)
			}
		}
	}

	return nil
}

// 构建树形结构
func (d *DoubaoShare) _buildTreeStructure(shareConfigs map[string]string, rootShares []string) map[string]*RootFileList {
	rootMap := make(map[string]*RootFileList)

	// 添加所有分享节点
	for sharePath, shareId := range shareConfigs {
		children := make([]RootFileList, 0)
		rootMap[sharePath] = &RootFileList{
			ShareID:     shareId,
			VirtualPath: sharePath,

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Move the nested entry to a sibling path that is not a prefix: 'docs|111' + 'books|222' instead of 'docs/books|222'.
  2. If nesting is truly desired, mount the subtree under the SAME share id (one line), not a second id.
  3. Normalize all paths consistently (no leading/trailing slashes) so intended siblings don't accidentally form a prefix chain.

Example fix

# before
docs|7412365891
docs/books|7412399887

# after
docs|7412365891
books|7412399887
Defensive patterns

Strategy: validation

Validate before calling

paths := normalizedMountPaths(lines) // trimmed, no leading/trailing '/'
for _, a := range paths {
    for _, b := range paths {
        if a != b && strings.HasPrefix(b, a+"/") {
            return fmt.Errorf("nested mount paths under different shares: %s vs %s", a, b)
        }
    }
}

Prevention

When it happens

Trigger: share_ids contains lines like 'docs|111' and 'docs/books|222' with different ids but overlapping path prefixes (checked with strings.HasPrefix(path, other+"/")). Fires during initShareList at mount/refresh time.

Common situations: Gradually adding shares and accidentally nesting a new one under an existing mount point; normalizing paths inconsistently (leading slash on one line, absent on the other) so the intended siblings become parent/child.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/995acf9ece16493e. Report an issue: GitHub.