juicedata/juicefs · error
compact [%d:%s] error: %s
Error message
compact [%d:%s] error: %s
What it means
doCompact wraps the errno returned by the metadata engine's Compact() call (issued via the internal fs layer). A non-zero errno other than EINVAL is reported as 'compact [inode:path] error: %s', meaning the compact operation failed at the metadata layer. EINVAL specifically is caught earlier and prompts an upgrade, so any message here is an unexpected engine-level failure.
Source
Thrown at cmd/compact.go:123
if err != nil {
logger.Fatalf("write message: %s", err)
}
progress := utils.NewProgress(false)
bar := progress.AddCountBar("Compacted chunks", 0)
_, errno := readProgress(f, func(totalChunks, currChunks uint64) {
bar.SetTotal(int64(totalChunks))
bar.SetCurrent(int64(currChunks))
})
bar.Done()
progress.Done()
if errno == syscall.EINVAL {
logger.Fatalf("compact is not supported, please upgrade and mount again")
}
if errno != 0 {
return fmt.Errorf("compact [%d:%s] error: %s", inode, path, errno)
}
logger.Infof("compact [%d:%q] success.", inode, path)
return nil
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Re-check the target file still exists and re-run `juicefs compact`
- Check metadata engine connectivity/health (redis-cli ping, DB logs)
- Confirm the mounted client and metadata engine versions both support compact; upgrade juicefs if needed
- Inspect logger output just above the error for the underlying engine error detail
Example fix
// before
err := doCompact(...) // prints 'compact [i:pkg] error: ...'
// after
if _, serr := os.Stat(mountPoint + "/" + path); serr != nil { log.Fatalf("target missing: %v", serr) }
err := doCompact(...) Defensive patterns
Strategy: try-catch
Validate before calling
test -e /mnt/jfs/$TARGET_PATH && echo ok || echo 'target missing'
Try / catch
if err := doCompact(...); err != nil {
if strings.Contains(err.Error(), "not supported") { /* upgrade path */ }
else { log.Printf("compact failed, retry later: %v", err) }
} Prevention
- Verify the file exists before compacting
- Keep client and metadata engine versions in sync
- Monitor metadata backend health
When it happens
Trigger: Running `juicefs compact <path>` on a mounted volume when the metadata engine's Compact call returns a non-zero errno (e.g. ENOENT because the inode no longer exists, EACCES, or engine-specific failures).
Common situations: Compacting a file deleted concurrently by another client; running compact against a metadata engine version lacking compact support in a way other than EINVAL; metadata backend connectivity issues mid-operation.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- changelog is not enabled, use `juicefs config %s --changelog
- clone failed: %v
- set tier for inode %d tier:%d failed: %w
- set tier for inode %d failed: %w
- user/group quota is inconsistent, please repair it with --re
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/47a6d32847cb25e3.
Report an issue: GitHub.