juicedata/juicefs · warning

The current trash will be emptied and future removed files w

Error message

The current trash will be emptied and future removed files will purged immediately.

What it means

When 'juicefs config' sets trash days to 0, the CLI warns that applying the change will empty the existing trash immediately and future deleted files will be purged at once instead of being retained. Deletion becomes irreversible, so the CLI asks for explicit confirmation unless --yes is given.

Source

Thrown at cmd/config.go:473

			if err = test(context.WithValue(context.Background(), object.TierKey{}, targetTierID), blob); err != nil {
				return err
			}
		}
		if quota {
			var totalSpace, availSpace, iused, iavail uint64
			_ = m.StatFS(meta.Background(), meta.RootInode, &totalSpace, &availSpace, &iused, &iavail)
			usedSpace := totalSpace - availSpace
			if format.Capacity > 0 && usedSpace >= format.Capacity ||
				format.Inodes > 0 && iused >= format.Inodes {
				warn("New quota is too small (used / quota): %d / %d bytes, %d / %d inodes.",
					usedSpace, format.Capacity, iused, format.Inodes)
				if !yes && !userConfirmed() {
					return fmt.Errorf("Aborted.")
				}
			}
		}
		if trash && format.TrashDays == 0 {
			warn("The current trash will be emptied and future removed files will purged immediately.")
			if !yes && !userConfirmed() {
				return fmt.Errorf("Aborted.")
			}
		}
		if originDirStats && !format.DirStats {
			qs := make(map[string]*meta.Quota)
			err := m.HandleQuota(meta.Background(), meta.QuotaList, "", meta.DirQuotaType, qs, false, false, false)
			if err != nil {
				return errors.Wrap(err, "list quotas")
			}
			if len(qs) != 0 {
				paths := make([]string, 0, len(qs))
				for path := range qs {
					paths = append(paths, path)
				}
				return fmt.Errorf("cannot disable dir stats when there are still %d dir quotas: %v", len(qs), paths)
			}
		}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Recover needed files from the trash first ('juicefs gc' or copying out of /.trash) before setting --trash-days 0
  2. Choose a small non-zero value (e.g. --trash-days 1) to keep a short retention window
  3. If the purge is intended, re-run with --yes to confirm

Example fix

// before
juicefs config sqlite3://test.db --trash-days 0
// after (keep 1 day of retention)
juicefs config sqlite3://test.db --trash-days 1
Defensive patterns

Strategy: validation

Validate before calling

fmt, _ := meta.LoadFormat(metaURI)
if fmt.TrashDays > 0 && targetTrashDays == 0 {
	// empty trash / recover files first
}

Try / catch

if strings.Contains(out, "The current trash will be emptied") {
	// confirm intentionally or abort
}

Prevention

When it happens

Trigger: Running 'juicefs config META --trash-days 0' on a volume that currently has a non-zero trash retention and files sitting in the trash directory.

Common situations: Operators disabling trash to reclaim space quickly; automations that set trash-days 0 without realizing pending deleted data is permanently destroyed.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/981c4a2086420a63. Report an issue: GitHub.