AlistGo/alist · error

empty token returned from online API

Error message

empty token returned from online API

What it means

Error "empty token returned from online API" thrown in AlistGo/alist.

Source

Thrown at drivers/aliyundrive_open/util.go:86

	if err != nil {
		return "", "", err
	}
	if resp.RefreshToken != "" && resp.AccessToken != "" {
		return resp.RefreshToken, resp.AccessToken, nil
	}
	if resp.ErrorMessage != "" {
		if res != nil && res.StatusCode() == http.StatusTooManyRequests {
			return d.refreshTokenWithLegacyFallback(ctx, resp.ErrorMessage, retryAfterFromResponse(res))
		}
		return "", "", fmt.Errorf("failed to refresh token: %s", resp.ErrorMessage)
	}
	if res != nil && res.StatusCode() == http.StatusTooManyRequests {
		return d.refreshTokenWithLegacyFallback(ctx, http.StatusText(http.StatusTooManyRequests), retryAfterFromResponse(res))
	}
	if e.Code != "" || e.Message != "" {
		return d.refreshTokenWithPost(ctx, d.OauthTokenURL)
	}
	return "", "", fmt.Errorf("empty token returned from online API")
}

func (d *AliyundriveOpen) refreshTokenWithLegacyFallback(ctx context.Context, message string, retryAfter time.Duration) (string, string, error) {
	if d.OauthTokenURL != legacyOauthTokenURL {
		log.Warnf("[ali_open] online refresh API is rate-limited, trying legacy fallback: %s", legacyOauthTokenURL)
		if refresh, access, err := d.refreshTokenWithPost(ctx, legacyOauthTokenURL); err == nil {
			return refresh, access, nil
		} else if _, ok := err.(*refreshRateLimitError); !ok {
			return "", "", err
		}
	}
	return "", "", &refreshRateLimitError{
		message:    fmt.Sprintf("failed to refresh token: %s", message),
		retryAfter: retryAfter,
	}
}

func (d *AliyundriveOpen) refreshTokenWithPost(ctx context.Context, url string) (string, string, error) {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Provide a valid token in the storage configuration and save it again.
  2. If the token expired, re-login or refresh it through the provider and update the configuration.

When it happens

Trigger: Thrown at drivers/aliyundrive_open/util.go:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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