{"record":{"id":"df87c330affbeca5","repo":"AlistGo/alist","slug":"invalid-directory-id","errorCode":null,"errorMessage":"invalid directory ID","messagePattern":"invalid directory ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/weiyun/driver.go","lineNumber":92,"sourceCode":"\t\t})\n\t}\n\n\t// 获取默认根目录dirKey\n\tif d.RootFolderID == \"\" {\n\t\tuserInfo, err := d.client.DiskUserInfoGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.RootFolderID = userInfo.MainDirKey\n\t}\n\n\t// 处理目录ID，找到PdirKey\n\tfolders, err := d.client.LibDirPathGet(d.RootFolderID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(folders) == 0 {\n\t\treturn fmt.Errorf(\"invalid directory ID\")\n\t}\n\n\tfolder := folders[len(folders)-1]\n\td.rootFolder = &Folder{\n\t\tPFolder: &Folder{\n\t\t\tFolder: weiyunsdkgo.Folder{\n\t\t\t\tDirKey: folder.PdirKey,\n\t\t\t},\n\t\t},\n\t\tFolder: folder.Folder,\n\t}\n\treturn nil\n}\n\nfunc (d *WeiYun) Drop(ctx context.Context) error {\n\td.client = nil\n\tif d.cron != nil {\n\t\td.cron.Stop()","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/weiyun/driver.go#L74-L110","documentation":"During Weiyun driver Init, the configured root_folder_id is resolved by walking the directory path from the personal main directory (LibDirPathGet). If the API returns an empty folder list, the ID does not exist under that account, and Init fails with a generic 'invalid directory ID'.","triggerScenarios":"Setting root_folder_id to a deleted folder, a folder belonging to another account, or a malformed ID; LibDirPathGet(d.RootFolderID) returning zero entries.","commonSituations":"Folder deleted after the storage was configured, copying storage config between accounts, or typing the ID manually with whitespace/full-width characters.","solutions":["Reset root_folder_id to empty to mount the account root (MainDirKey) and verify access.","Browse via the API/official client, copy the correct folder ID, and update the storage config.","Confirm the Weiyun account credentials are the owner of the target folder."],"exampleFix":"// before\nroot_folder_id = \"abc-deleted-folder\"\n\n// after\nroot_folder_id = \"\"   // mount account root","handlingStrategy":"validation","validationCode":"// before saving config, probe the folder\nfolders, err := client.LibDirPathGet(candidateRootFolderID)\nif err != nil || len(folders) == 0 {\n    return fmt.Errorf(\"root_folder_id %q not resolvable\", candidateRootFolderID)\n}","typeGuard":null,"tryCatchPattern":"if err := d.Init(ctx); err != nil && strings.Contains(err.Error(), \"invalid directory ID\") {\n    // reset root_folder_id to \"\" (account root) and retry Init\n}","preventionTips":["Leave root_folder_id empty when mounting the whole account","Update folder IDs after deleting/recreating folders","Never copy folder IDs between different Weiyun accounts"],"tags":["weiyun","config","folder-id","init"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}