AlistGo/alist · error

%s: %v

Error message

%s: %v

What it means

Generic Google Drive API request error: the response parsed as a Drive error object with non-zero code that is not 401, returned as '<message>: <errors>'. It covers every GET/LIST/DELETE/metadata call made through d.request, exposing reasons like fileNotFound, insufficientFilePermissions, dailyLimitExceeded.

Source

Thrown at drivers/google_drive/util.go:178

	}
	if resp != nil {
		req.SetResult(resp)
	}
	var e Error
	req.SetError(&e)
	res, err := req.Execute(method, url)
	if err != nil {
		return nil, err
	}
	if e.Error.Code != 0 {
		if e.Error.Code == 401 {
			err = d.refreshToken()
			if err != nil {
				return nil, err
			}
			return d.request(url, method, callback, resp)
		}
		return nil, fmt.Errorf("%s: %v", e.Error.Message, e.Error.Errors)
	}
	return res.Body(), nil
}

func (d *GoogleDrive) getFiles(id string) ([]File, error) {
	pageToken := "first"
	res := make([]File, 0)
	for pageToken != "" {
		if pageToken == "first" {
			pageToken = ""
		}
		var resp Files
		orderBy := "folder,name,modifiedTime desc"
		if d.OrderBy != "" {
			orderBy = d.OrderBy + " " + d.OrderDirection
		}
		query := map[string]string{
			"orderBy":  orderBy,

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Identify the reason field in '<errors>' and act: fileNotFound -> refresh listing; quota -> raise limits or throttle; insufficientFilePermissions -> share the resource with the service account address
  2. Verify the credential's scopes cover the operation (drive vs drive.readonly vs drive.file)
  3. Add exponential backoff for 403 rate-limit reasons instead of hammering retries
  4. For shared drives, confirm supportsAllDrives membership of the credential
Defensive patterns

Strategy: retry

Type guard

func isDriveRetryable(err error) bool {
  if err == nil { return false }
  s := err.Error()
  return strings.Contains(s, "userRateLimitExceeded") || strings.Contains(s, "dailyLimitExceeded") || strings.Contains(s, "RateLimitExceeded")
}

Try / catch

body, err := d.request(url, method, cb, resp)
if err != nil {
  if isDriveRetryable(err) { /* exponential backoff honoring Retry-After */ }
  if strings.Contains(err.Error(), "File not found") { /* invalidate cache, skip */ }
}

Prevention

When it happens

Trigger: Any Drive API call through request() failing with a structured error: listing a deleted folder, reading a file the credential lacks scope for, per-user or per-project quota exhaustion, shared-drive member removed.

Common situations: Stale listing caches referencing deleted files; service account not shared on the target drive; API quota exhausted by aggressive polling; user revoked consent partially.

Related errors


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