AlistGo/alist · error
invalid directory ID
Error message
invalid directory ID
What it means
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'.
Source
Thrown at drivers/weiyun/driver.go:92
})
}
// 获取默认根目录dirKey
if d.RootFolderID == "" {
userInfo, err := d.client.DiskUserInfoGet()
if err != nil {
return err
}
d.RootFolderID = userInfo.MainDirKey
}
// 处理目录ID,找到PdirKey
folders, err := d.client.LibDirPathGet(d.RootFolderID)
if err != nil {
return err
}
if len(folders) == 0 {
return fmt.Errorf("invalid directory ID")
}
folder := folders[len(folders)-1]
d.rootFolder = &Folder{
PFolder: &Folder{
Folder: weiyunsdkgo.Folder{
DirKey: folder.PdirKey,
},
},
Folder: folder.Folder,
}
return nil
}
func (d *WeiYun) Drop(ctx context.Context) error {
d.client = nil
if d.cron != nil {
d.cron.Stop()View on GitHub (pinned to 843d9dc814)
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.
Example fix
// before root_folder_id = "abc-deleted-folder" // after root_folder_id = "" // mount account root
Defensive patterns
Strategy: validation
Validate before calling
// before saving config, probe the folder
folders, err := client.LibDirPathGet(candidateRootFolderID)
if err != nil || len(folders) == 0 {
return fmt.Errorf("root_folder_id %q not resolvable", candidateRootFolderID)
} Try / catch
if err := d.Init(ctx); err != nil && strings.Contains(err.Error(), "invalid directory ID") {
// reset root_folder_id to "" (account root) and retry Init
} Prevention
- 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
When it happens
Trigger: Setting root_folder_id to a deleted folder, a folder belonging to another account, or a malformed ID; LibDirPathGet(d.RootFolderID) returning zero entries.
Common situations: Folder deleted after the storage was configured, copying storage config between accounts, or typing the ID manually with whitespace/full-width characters.
Related errors
- owner and repo are required
- api_login and api_key are required
- paths is required
- SaveStrmLocalPath is required
- no valid path mapping found
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/df87c330affbeca5.
Report an issue: GitHub.