AlistGo/alist · error

no valid share_ids found

Error message

no valid share_ids found

What it means

initShareList parsed the share_ids lines and built the virtual directory tree, but _extractTopLevelNodes produced zero nodes. Every configured line was discarded during parsing/tree-building — typically all lines were empty after trimming or failed the path|id split in a way that left no usable roots.

Source

Thrown at drivers/doubao_share/util.go:205

	// 解析分享配置
	shareConfigs, rootShares, err := d._parseShareConfigs()
	if err != nil {
		return err
	}

	// 检查路径冲突
	if err := d._detectPathConflicts(shareConfigs); err != nil {
		return err
	}

	// 构建树形结构
	rootMap := d._buildTreeStructure(shareConfigs, rootShares)

	// 提取顶级节点
	topLevelNodes := d._extractTopLevelNodes(rootMap, rootShares)
	if len(topLevelNodes) == 0 {
		return fmt.Errorf("no valid share_ids found")
	}

	// 存储结果
	d.RootFiles = topLevelNodes

	return nil
}

// 从配置中解析分享ID和路径
func (d *DoubaoShare) _parseShareConfigs() (map[string]string, []string, error) {
	shareConfigs := make(map[string]string) // 路径 -> 分享ID
	rootShares := make([]string, 0)         // 根目录显示的分享ID

	lines := strings.Split(strings.TrimSpace(d.Addition.ShareIds), "\n")
	if len(lines) == 0 {
		return nil, nil, fmt.Errorf("no share_ids found")
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Rewrite share_ids as one entry per line: either 'share_id' or 'mount_path|share_id', no extra columns.
  2. Strip blank lines and CRLF (save the config with LF) and ensure at least one valid entry remains.
  3. Confirm each share_id is the bare identifier (the value after /s/ in the share URL), not the whole URL.

Example fix

# before
share_ids = "https://www.doubao.com/s/abc123"

# after
share_ids = "abc123"
Defensive patterns

Strategy: validation

Validate before calling

valid := 0
for _, line := range strings.Split(strings.TrimSpace(cfg), "\n") {
    line = strings.TrimSpace(line)
    if line == "" { continue }
    if !shareIDPattern.MatchString(extractID(line)) { continue }
    valid++
}
if valid == 0 { return fmt.Errorf("no valid share_ids lines found in config") }

Type guard

var shareIDPattern = regexp.MustCompile(`^[0-9A-Za-z_-]{8,}$`)

func isValidShareLine(line string) bool {
    line = strings.TrimSpace(line)
    if line == "" { return false }
    id := line
    if i := strings.Index(line, "|"); i >= 0 { id = line[i+1:] }
    return shareIDPattern.MatchString(strings.TrimSpace(id))
}

Prevention

When it happens

Trigger: share_ids contains only whitespace/blank lines; lines use a separator other than '|' so the path/id split yields nothing usable; every configured share_id already consumed by subtree placement leaving no roots (mis-built rootShares list).

Common situations: User pastes share URLs instead of raw share_ids; trailing whitespace or CRLF line endings from Windows editors producing lines that trim to nothing; a misformatted 'path|id|extra' line.

Related errors


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