AlistGo/alist · error
redirect failed, status: %d, msg: %s
Error message
redirect failed, status: %d, msg: %s
What it means
Thrown by ILanZou's link resolution when the download-URL request returns anything other than a 302 redirect. The driver relies on the server answering with a Location header pointing at the real file host; any other status (200 HTML error page, 403, 429) is a failure. The server's JSON msg is extracted and included.
Source
Thrown at drivers/ilanzou/driver.go:169
// get the url after redirect
req := base.NoRedirectClient.R()
req.SetHeaders(map[string]string{
"Referer": d.conf.site + "/",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",
})
if d.Addition.Ip != "" {
req.SetHeader("X-Forwarded-For", d.Addition.Ip)
}
res, err := req.Get(realURL)
if err != nil {
return nil, err
}
if res.StatusCode() == 302 {
realURL = res.Header().Get("location")
} else {
return nil, fmt.Errorf("redirect failed, status: %d, msg: %s", res.StatusCode(), utils.Json.Get(res.Body(), "msg").ToString())
}
link := model.Link{URL: realURL}
return &link, nil
}
func (d *ILanZou) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {
res, err := d.proved("/file/folder/save", http.MethodPost, func(req *resty.Request) {
req.SetBody(base.Json{
"folderDesc": "",
"folderId": parentDir.GetID(),
"folderName": dirName,
})
})
if err != nil {
return nil, err
}
return &model.Object{
ID: utils.Json.Get(res, "list", 0, "id").ToString(),View on GitHub (pinned to 843d9dc814)
Solutions
- Read the embedded msg — it distinguishes 'file not exist' from rate-limit/auth errors.
- Re-list the directory to confirm the file still exists; deleted files are a top cause.
- Set/rotate Addition.Ip (X-Forwarded-For) to a residential-looking IP if the server blocks datacenter IPs.
- Back off and retry later for 429-style rate limiting; add delay between link resolutions.
Defensive patterns
Strategy: retry
Try / catch
link, err := d.Link(ctx, obj, args)
if err != nil && strings.Contains(err.Error(), "redirect failed") {
if !fileStillListed(ctx, parentPath, obj.GetName()) { return errors.New("file deleted") }
time.Sleep(2 * time.Second)
link, err = d.Link(ctx, obj, args)
}
if err != nil { return err } Prevention
- Verify the file still exists before resolving links
- Throttle link resolution frequency
- Keep Addition.Ip (X-Forwarded-For) configured to a stable value
When it happens
Trigger: The file was deleted or set private between listing and link fetch; anti-leech token/cookie expired; IP ban (the X-Forwarded-For spoof via Addition.Ip no longer accepted); rate limiting on the redirect endpoint.
Common situations: Expired share links; too-frequent programmatic downloads from one IP; wrong Addition.Ip configuration; ilanzou changing their redirect flow so the endpoint now returns 200 with an error body instead of 302.
Related errors
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/bd23214f7b808da0.
Report an issue: GitHub.