Billionmail/BillionMail · error
disk quota exceeded
Error message
disk quota exceeded
What it means
GzipUnpacker.incWritten tracks every byte written through a quota-limited writer while compressing. When the cumulative bytes written exceed the configured quota (z.quota, where -1 means unlimited), it returns this error to abort the compression. It is a safety guard against runaway disk usage, not an OS-level quota failure.
Source
Thrown at core/internal/service/compress/gzip.go:56
defer z.mutex.Unlock()
z.quota = quota
}
// incWritten increases the size of already compressed file
func (z *GZipper) incWritten(n int64) (err error) {
// if no limit is set, do nothing
if z.quota < 0 {
return nil
}
z.mutex.Lock()
defer z.mutex.Unlock()
z.written += n
// check if exceeds the limit
if z.quota > -1 && z.written > z.quota {
err = errors.New("disk quota exceeded")
return
}
return nil
}
// compressHelper packs a file or directory into tar
func (z *GZipper) compressHelper(tw *tar.Writer, path string, fi os.FileInfo, root string) error {
header, err := tar.FileInfoHeader(fi, "")
if err != nil {
return err
}
// compatible with Linux path rules
header.Name = strings.TrimPrefix(strings.TrimPrefix(filepath.ToSlash(path), "./"), "/")
header.Name = strings.TrimPrefix(strings.TrimPrefix(header.Name, root), "/")
View on GitHub (pinned to fc36c76c05)
Solutions
- Increase the quota via SetQuota before compressing, based on the expected output size
- Remove the quota by setting it to -1 if disk space is managed elsewhere
- Free disk space or move the output to a larger volume and retry
- Pre-check the source size (du/os.Stat walk) and ensure quota comfortably exceeds expected compressed size
Example fix
// before
u, _ := compress.NewGzipUnpacker(1024*1024) // 1MB quota
err := u.Compress("out.tar.gz", bigDir)
// after
u, _ := compress.NewGzipUnpacker(-1) // unlimited, or size-based quota
err := u.Compress("out.tar.gz", bigDir) Defensive patterns
Strategy: validation
Validate before calling
var total int64
filepath.WalkDir(src, func(_ string, d fs.DirEntry, err error) error {
if err != nil { return err }
if !d.IsDir() { if i, _ := d.Info(); i != nil { total += i.Size() } }
return nil
})
if quota > -1 && total > quota { /* raise quota or reject job */ } Try / catch
if err := u.Compress(dst, src...); err != nil && strings.Contains(err.Error(), "disk quota exceeded") {
// raise quota and retry or alert operator
} Prevention
- Size the quota from source statistics before every compression job
- Set quota = -1 when disk usage is managed by the OS or cgroups
- Monitor written bytes via incWritten and fail early with your own metric
- Alert on jobs that repeatedly hit the quota instead of silently retrying
When it happens
Trigger: Calling GzipUnpacker.Compress (or Decompress) on data whose total output exceeds the quota set via SetQuota/constructor when quota > -1; e.g. compressing a multi-GB directory into an archive whose output surpasses the limit.
Common situations: Admins configured a small disk quota for temp/backup space; users compressing large log or media directories; quota left at a stale low default after data growth.
Related errors
- illegal file path:
- disk quota exceeded
- illegal file path:
- rar command not found, please install it first
- source file/directory does not exist: %s
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/ea7cf9d8d4c52548.
Report an issue: GitHub.