{"record":{"id":"e9d3ff248ab59a7c","repo":"AlistGo/alist","slug":"no-valid-share-ids-found","errorCode":null,"errorMessage":"no valid share_ids found","messagePattern":"no valid share_ids found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao_share/util.go","lineNumber":205,"sourceCode":"\n\t// 解析分享配置\n\tshareConfigs, rootShares, err := d._parseShareConfigs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// 检查路径冲突\n\tif err := d._detectPathConflicts(shareConfigs); err != nil {\n\t\treturn err\n\t}\n\n\t// 构建树形结构\n\trootMap := d._buildTreeStructure(shareConfigs, rootShares)\n\n\t// 提取顶级节点\n\ttopLevelNodes := d._extractTopLevelNodes(rootMap, rootShares)\n\tif len(topLevelNodes) == 0 {\n\t\treturn fmt.Errorf(\"no valid share_ids found\")\n\t}\n\n\t// 存储结果\n\td.RootFiles = topLevelNodes\n\n\treturn nil\n}\n\n// 从配置中解析分享ID和路径\nfunc (d *DoubaoShare) _parseShareConfigs() (map[string]string, []string, error) {\n\tshareConfigs := make(map[string]string) // 路径 -> 分享ID\n\trootShares := make([]string, 0)         // 根目录显示的分享ID\n\n\tlines := strings.Split(strings.TrimSpace(d.Addition.ShareIds), \"\\n\")\n\tif len(lines) == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"no share_ids found\")\n\t}\n","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao_share/util.go#L187-L223","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Rewrite share_ids as one entry per line: either 'share_id' or 'mount_path|share_id', no extra columns.","Strip blank lines and CRLF (save the config with LF) and ensure at least one valid entry remains.","Confirm each share_id is the bare identifier (the value after /s/ in the share URL), not the whole URL."],"exampleFix":"# before\nshare_ids = \"https://www.doubao.com/s/abc123\"\n\n# after\nshare_ids = \"abc123\"","handlingStrategy":"validation","validationCode":"valid := 0\nfor _, line := range strings.Split(strings.TrimSpace(cfg), \"\\n\") {\n    line = strings.TrimSpace(line)\n    if line == \"\" { continue }\n    if !shareIDPattern.MatchString(extractID(line)) { continue }\n    valid++\n}\nif valid == 0 { return fmt.Errorf(\"no valid share_ids lines found in config\") }","typeGuard":"var shareIDPattern = regexp.MustCompile(`^[0-9A-Za-z_-]{8,}$`)\n\nfunc isValidShareLine(line string) bool {\n    line = strings.TrimSpace(line)\n    if line == \"\" { return false }\n    id := line\n    if i := strings.Index(line, \"|\"); i >= 0 { id = line[i+1:] }\n    return shareIDPattern.MatchString(strings.TrimSpace(id))\n}","tryCatchPattern":null,"preventionTips":["Paste bare share ids or 'path|id' pairs only — never full URLs.","Save config with LF endings and no blank-line padding.","Test the config in a scratch mount before automating."],"tags":["doubao-share","config","validation"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}