AlistGo/alist · error

refresh access_token failed: %w

Error message

refresh access_token failed: %w

What it means

Error "refresh access_token failed: %w" thrown in AlistGo/alist.

Source

Thrown at drivers/123_open/client.go:82

	}
	d.tokenMu.Lock()
	defer d.tokenMu.Unlock()

	if !d.tokenNeedsRefresh() {
		return nil
	}
	if d.RefreshToken == "" || d.ClientID == "" || d.ClientSecret == "" {
		if d.accessTokenExpiredAt.IsZero() {
			// expiry unknown and no way to refresh: keep using the token and let
			// the API surface the authoritative error
			return nil
		}
		return errNoRefreshCredentials
	}

	token, err := d.client.OAuth.RefreshToken(ctx, d.ClientID, d.ClientSecret, d.RefreshToken)
	if err != nil {
		return fmt.Errorf("refresh access_token failed: %w", err)
	}
	d.AccessToken = token.AccessToken
	if token.RefreshToken != "" {
		d.RefreshToken = token.RefreshToken
	}
	d.accessTokenExpiredAt = time.Now().Add(time.Duration(token.ExpiresIn) * time.Second)
	d.client.SetToken(d.AccessToken, d.accessTokenExpiredAt)
	// persist immediately: the previous refresh_token is already void
	d.persist()
	return nil
}

// persist writes the rotated credentials back to the storage config.
func (d *Open123) persist() {
	if d.persistFn != nil {
		d.persistFn()
		return
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-authenticate the storage: obtain a new refresh_token via the provider's OAuth flow and update the storage configuration.
  2. Verify client_id/client_secret are correct and the refresh token has not been revoked or expired.

When it happens

Trigger: Thrown at drivers/123_open/client.go:82 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/e7d10b319cdf5be6. Report an issue: GitHub.