AlistGo/alist · error

%s: %v

Error message

%s: %v

What it means

Generic Google Photos API request error: response parsed as an error object with non-zero code other than 401, returned as '<message>: <errors>'. Covers listing albums, fetching media items, and the upload byte-transfer calls made via d.request with custom upload headers.

Source

Thrown at drivers/google_photo/util.go:69

	}
	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, headers)
		}
		return nil, fmt.Errorf("%s: %v", e.Error.Message, e.Error.Errors)
	}
	return res.Body(), nil
}

func (d *GooglePhoto) getFiles(id string) ([]MediaItem, error) {
	switch id {
	case FETCH_ALL:
		return d.getAllMedias()
	case FETCH_ALBUMS:
		return d.getAlbums()
	case FETCH_SHARE_ALBUMS:
		return d.getShareAlbums()
	case FETCH_ROOT:
		return d.getFakeRoot()
	default:
		return d.getMedias(id)
	}
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Act on the reason in '<errors>': not-found -> refresh listings; rate-limit -> backoff; permission -> re-consent with correct scopes
  2. Enable/verify the Photos Library API for the project and its quota
  3. Cache album/media listings briefly and invalidate on 404 reasons
  4. Wrap listing loops with retry-after handling for 403 quota errors
Defensive patterns

Strategy: retry

Type guard

func isPhotosRetryable(err error) bool {
  return err != nil && strings.Contains(err.Error(), "Rate") || strings.Contains(err.Error(), "backendError")
}

Try / catch

body, err := d.request(url, method, cb, resp, headers)
if err != nil {
  if isPhotosRetryable(err) { /* backoff and retry once */ }
  if strings.Contains(err.Error(), "No such media") { /* drop from cache */ }
}

Prevention

When it happens

Trigger: Any Photos API call failing structurally: mediaItem not found after deletion, album access revoked, API not enabled, per-minute quota exceeded, invalid pageToken from stale pagination state.

Common situations: Cached listing pointing at deleted media; Photos API disabled mid-session; heavy polling hitting 6000 requests/minute/project; token scopes narrowed after re-consent.

Related errors


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