{"record":{"id":"7c0a5791caed2805","repo":"juicedata/juicefs","slug":"statistic-v","errorCode":null,"errorMessage":"statistic: %v","messagePattern":"statistic: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/status.go","lineNumber":99,"sourceCode":"\t\t\t\t\ttrashSlicesSpinner.IncrInt64(int64(s.Size))\n\t\t\t\t}\n\t\t\t\treturn false, nil\n\t\t\t},\n\t\t\tfunc(_ uint64, size uint32) (bool, error) {\n\t\t\t\tpendingDeletedSlicesSpinner.IncrInt64(int64(size))\n\t\t\t\treturn false, nil\n\t\t\t},\n\t\t\tfunc(_ Ino, size uint64, _ time.Time, count int64) (bool, error) {\n\t\t\t\ttrashFileSpinner.Add(count, int64(size))\n\t\t\t\treturn false, nil\n\t\t\t},\n\t\t\tfunc(_ Ino, size uint64, _ int64) (bool, error) {\n\t\t\t\tpendingDeletedFileSpinner.IncrInt64(int64(size))\n\t\t\t\treturn false, nil\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"statistic: %v\", err)\n\t\t}\n\n\t\ttrashSlicesSpinner.Done()\n\t\tpendingDeletedSlicesSpinner.Done()\n\t\ttrashFileSpinner.Done()\n\t\tpendingDeletedFileSpinner.Done()\n\t\tstat.TrashSliceCount, stat.TrashSliceSize = trashSlicesSpinner.Current()\n\t\tstat.PendingDeletedSliceCount, stat.PendingDeletedSliceSize = pendingDeletedSlicesSpinner.Current()\n\t\tstat.TrashFileCount, stat.TrashFileSize = trashFileSpinner.Current()\n\t\tstat.PendingDeletedFileCount, stat.PendingDeletedFileSize = pendingDeletedFileSpinner.Current()\n\t}\n\n\tif sections != nil {\n\t\tsections.Setting = format\n\t\tsections.Sessions = sessions\n\t\tsections.Stat = stat\n\t}\n\treturn nil","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/status.go#L81-L117","documentation":"When `juicefs status --trash` (or the trash section) runs, it walks trash slices/files and pending-deleted objects to compute statistics via m.CleanupTrash-like callbacks (here, the pending deleted files scan). If the underlying scan (e.g. ListPendingDeletedFiles through fs layer) errors, Status wraps it as 'statistic'. This is the trash-statistics walk failing, not the core status.","triggerScenarios":"Running `juicefs status META-URL --trash` when the pending-deleted-files enumeration callback returns an error — object storage listing failures, metadata records for trash unreadable, or the scan being aborted by an internal error mid-walk.","commonSituations":"Object storage credentials revoked or bucket removed while trash stats are gathered; network flakiness during a long trash scan on volumes with many pending deletes; metadata engine errors while iterating trash records.","solutions":["Run `juicefs status META-URL` without --trash to confirm the core status works, isolating the issue to the trash/object-storage scan.","Verify object storage access with the same credentials/bucket from the volume format (try mc ls / aws s3 ls on the bucket).","Retry during a quieter period; large pending-deleted queues make the scan long — allow `juicefs gc` to finish first to shrink the backlog.","If the inner error indicates metadata corruption of trash records, restore metadata from a `juicefs dump` backup."],"exampleFix":"// before (fails only with trash scan)\njuicefs status \"redis://127.0.0.1:6379/1\" --trash\n// after — validate object storage first, then retry\naws s3 ls s3://mybucket\njuicefs status \"redis://127.0.0.1:6379/1\" --trash","handlingStrategy":"validation","validationCode":"# verify object storage access with the same credentials as the volume format\nmc ls myminio/mybucket >/dev/null && echo \"object storage OK\" || echo \"check credentials/bucket\"","typeGuard":null,"tryCatchPattern":"if err := execStatusWithTrash(metaURL); err != nil && strings.Contains(err.Error(), \"statistic\") {\n    log.Printf(\"trash stats unavailable, core status still valid: %v\", err)\n    return execStatus(metaURL) // fall back to plain status\n}","preventionTips":["Verify object storage credentials/bucket before running status --trash","Drain pending deletes with juicefs gc before long trash scans","Run --trash scans from a client with stable network access to both meta and object storage"],"tags":["cli","trash","object-storage","metadata"],"backgroundTag":"resource-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}