AlistGo/alist · error
resp.String()
Error message
resp.String()
What it means
This is the Cloudreve driver's generic HTTP failure path: the response status was not 2xx (resp.IsSuccess() false) and the error message is the raw response body. Because the body is whatever the Cloudvre server returned (HTML error page, gateway text, JSON fault), the 'message' literally shows as resp.String() content — often unstructured and not the driver's structured {code} format.
Source
Thrown at drivers/cloudreve/util.go:62
req.SetHeaders(map[string]string{
"Cookie": "cloudreve-session=" + d.Cookie,
"Accept": "application/json, text/plain, */*",
"User-Agent": d.getUA(),
})
var r Resp
req.SetResult(&r)
if callback != nil {
callback(req)
}
resp, err := req.Execute(method, u)
if err != nil {
return err
}
if !resp.IsSuccess() {
return errors.New(resp.String())
}
if r.Code != 0 {
// 刷新 cookie
if r.Code == http.StatusUnauthorized && path != loginPath {
if d.Username != "" && d.Password != "" {
err = d.login()
if err != nil {
return err
}
return d.request(method, path, callback, out)
}
}
return errors.New(r.Msg)
}
sess := cookie.GetCookie(resp.Cookies(), "cloudreve-session")View on GitHub (pinned to 843d9dc814)
Solutions
- Check the raw body captured with the error — it usually names the real cause (session expired, 404, Cloudflare block)
- Re-login/refresh credentials: verify username/password in the storage config; the driver re-logins on code 401 only for non-login paths, so re-save the storage to force a fresh login
- Verify the site URL points directly at the Cloudvre instance (bypass CDN/challenge pages) and that its version's API routes match this driver
- If a gateway 5xx, retry later or increase proxy timeouts for large transfers
Defensive patterns
Strategy: retry
Validate before calling
// Health-check the Cloudvre endpoint before real work
resp, err := resty.New().R().Get(siteURL)
if err != nil || !resp.IsSuccess() {
return fmt.Errorf("cloudreve site unhealthy (status %d); check URL/proxy/CDN", resp.StatusCode())
} Try / catch
err := drv.Request(method, path, nil, &out)
if err != nil {
body := err.Error() // raw server body
switch {
case strings.Contains(body, "401") || strings.Contains(body, "Unauthorized"):
_ = forceRelogin(drv) // re-save storage / refresh credentials
case strings.Contains(body, "cloudflare") || strings.Contains(body, "<html"):
return fmt.Errorf("CDN/challenge page hit; bypass it for the API host")
default:
return retryWithBackoff(err) // transient 5xx
}
} Prevention
- Point the storage at the Cloudvre origin, not a CDN-protected front
- Keep credentials current; re-save the storage config to force re-login after password changes
- After upgrading Cloudvre, verify API paths still match this driver version
When it happens
Trigger: Any Cloudvre API call (request()) where the server answers with 4xx/5xx: expired session cookie hitting a protected path, 404 from a renamed/removed route after a Cloudvre upgrade, 502/504 from an overloaded gateway, or Cloudflare challenge HTML in front of the site. Note r.Code-based cookie refresh only runs AFTER IsSuccess, so auth failures surfaced as HTTP 401 bodies land here first when the path is loginPath or the body isn't parsed.
Common situations: Wrong site URL or API base; Cloudvre instance behind Cloudflare/CDN returning HTML; cookie invalidated by server restart or password change; Cloudvre major version changing API routes; reverse proxy timeouts on large uploads.
Related errors
- r.Msg
- res.Status
- stopped after 10 redirects
- gofile API error: HTTP %d - %s
- failed to execute rename request: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/71877e9a230e4fbd.
Report an issue: GitHub.