cloudreve/cloudreve · error
thumb size not found
Error message
thumb size not found
What it means
During OneDrive Credential.Refresh, the loader fails to fetch its own storage policy row via inventory StoragePolicyClient.GetPolicyByID(c.PolicyID) (oauth.go:93-98). The credential embeds the policy ID it was minted for; without the row, the OAuth endpoint, client id, secret, and redirect needed for the refresh cannot be read, and the wrapped database error is returned.
Source
Thrown at pkg/filemanager/driver/onedrive/client.go:27
"github.com/cloudreve/Cloudreve/v4/pkg/credmanager"
"github.com/cloudreve/Cloudreve/v4/pkg/filemanager/fs"
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
"github.com/cloudreve/Cloudreve/v4/pkg/setting"
"github.com/cloudreve/Cloudreve/v4/pkg/request"
)
var (
// ErrAuthEndpoint 无法解析授权端点地址
ErrAuthEndpoint = errors.New("failed to parse endpoint url")
// ErrInvalidRefreshToken 上传策略无有效的RefreshToken
ErrInvalidRefreshToken = errors.New("no valid refresh token in this policy")
// ErrDeleteFile 无法删除文件
ErrDeleteFile = errors.New("cannot delete file")
// ErrClientCanceled 客户端取消操作
ErrClientCanceled = errors.New("client canceled")
// Desired thumb size not available
ErrThumbSizeNotFound = errors.New("thumb size not found")
)
type Client interface {
ListChildren(ctx context.Context, path string) ([]FileInfo, error)
Meta(ctx context.Context, id string, path string) (*FileInfo, error)
CreateUploadSession(ctx context.Context, dst string, opts ...Option) (string, error)
GetSiteIDByURL(ctx context.Context, siteUrl string) (string, error)
GetUploadSessionStatus(ctx context.Context, uploadURL string) (*UploadSessionResponse, error)
Upload(ctx context.Context, file *fs.UploadRequest) error
SimpleUpload(ctx context.Context, dst string, body io.Reader, size int64, opts ...Option) (*UploadResult, error)
DeleteUploadSession(ctx context.Context, uploadURL string) error
BatchDelete(ctx context.Context, dst []string) ([]string, error)
GetThumbURL(ctx context.Context, dst string) (string, error)
OAuthURL(ctx context.Context, scopes []string) string
ObtainToken(ctx context.Context, opts ...Option) (*Credential, error)
}
// client OneDrive客户端View on GitHub (pinned to 20c95ad73f)
Solutions
- Confirm the policy ID exists (admin → storage policies; check the credential's PolicyID)
- If the policy is gone, evict/purge the stale credential from the credential manager instead of retrying
- Check DB connectivity and ent logs for the underlying error
- If the policy was recreated with a new ID, re-run the OneDrive OAuth flow to mint a credential for the new ID
Example fix
// before
policy, err := storagePolicyClient.GetPolicyByID(ctx, c.PolicyID)
if err != nil {
return nil, fmt.Errorf("failed to get storage policy: %w", err)
}
// after — distinguish a missing policy so the caller can evict the credential
policy, err := storagePolicyClient.GetPolicyByID(ctx, c.PolicyID)
if err != nil {
if ent.IsNotFound(err) {
return nil, fmt.Errorf("storage policy %d no longer exists; revoke this credential: %w", c.PolicyID, err)
}
return nil, fmt.Errorf("failed to get storage policy %d: %w", c.PolicyID, err)
} Defensive patterns
Strategy: validation
Validate before calling
// Before scheduling a refresh, confirm the policy still exists
if _, err := storagePolicyClient.GetPolicyByID(ctx, cred.PolicyID); ent.IsNotFound(err) {
// evict the stale credential instead of retrying a doomed refresh
_ = credManager.Delete(ctx, cred.Key())
} Type guard
func isPolicyMissing(err error) bool {
return ent.IsNotFound(err)
} Try / catch
if err != nil {
if isPolicyMissing(err) {
// evict credential, mark policy as needing re-auth; do not retry
}
// DB transient: retry refresh later
return nil, fmt.Errorf("failed to get storage policy: %w", err)
} Prevention
- Cascade-delete stored credentials when a storage policy is removed
- Run a periodic consistency job between policies and the credential store
- After DB restores, re-authenticate OneDrive policies whose IDs changed
When it happens
Trigger: The OneDrive storage policy was deleted from the admin panel while its credential still sits in the credential manager; database unreachable during refresh; PolicyID stale after a DB restore or migration; ent returning not-found for the cached row.
Common situations: Deleting an 'unused' OneDrive policy while background jobs still hold its credential; DB flaps during token refresh; restoring the DB from a backup taken before the policy was recreated with a new ID.
Related errors
- invalid response from S3: missing ContentLength
- faield to retrieve OneDrive credentials for CredManager: %w
- failed to upsert OneDrive credentials to CredManager: %w
- failed to create default OAuth client: %w
- failed to refresh credential for key %q: %w
AI-assisted analysis of cloudreve/cloudreve@20c95ad73f (2026-08-16).
Data as JSON: /api/errors/5f367c61d7b903cd.
Report an issue: GitHub.