AlistGo/alist · error

r.Msg

Error message

r.Msg

What it means

CloudreveV4's API-envelope error: HTTP was 2xx but r.Code != 0 and the case is not the refreshable-401 path, so the server's message (r.Msg) is returned directly. Every V4 driver operation funnels through this single check.

Source

Thrown at drivers/cloudreve_v4/util.go:74

	resp, err := req.Execute(method, u)
	if err != nil {
		return err
	}
	if !resp.IsSuccess() {
		return errors.New(resp.String())
	}

	if r.Code != 0 {
		if r.Code == 401 && d.RefreshToken != "" && path != "/session/token/refresh" {
			// try to refresh token
			err = d.refreshToken()
			if err != nil {
				return err
			}
			return d.request(method, path, callback, out)
		}
		return errors.New(r.Msg)
	}

	if out != nil && r.Data != nil {
		var marshal []byte
		marshal, err = json.Marshal(r.Data)
		if err != nil {
			return err
		}
		err = json.Unmarshal(marshal, out)
		if err != nil {
			return err
		}
	}

	return nil
}

func (d *CloudreveV4) login() error {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-save the storage so the driver performs a fresh login and stores new tokens.
  2. Verify the account still exists and its password unchanged on the Cloudrebve V4 server.
  3. Check the path/root folder configuration still points to an existing directory.
  4. Inspect the V4 server logs for the failing route to see the exact reason behind r.Msg.
Defensive patterns

Strategy: retry

Try / catch

if err := d.request(method, path, cb, out); err != nil {
    if d.RefreshToken != "" && isAuthCode(err) { // r.Code==401 path already retries once
        if rerr := d.refreshToken(); rerr == nil {
            return d.request(method, path, cb, out)
        }
        return d.login() // full re-login when refresh token is exhausted
    }
    return err
}

Prevention

When it happens

Trigger: Any authenticated V4 call whose body code is non-zero: expired access token when no RefreshToken is set, insufficient permission, nonexistent path, or the server refusing the specific operation. The 401 branch only self-heals when d.RefreshToken is non-empty and the path is not the refresh endpoint itself.

Common situations: Access/refresh tokens expired and revoked (server restarted, user logged out all sessions); wrong root path; read-only account; token refresh failing because the refresh token was single-use and already consumed.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/0bb3477017ef8792. Report an issue: GitHub.