weaviate/weaviate · error

cleanup

Error message

cleanup

What it means

Step 1 of a compaction RunCycle failed: removing orphaned temp files and detecting commit-log overlaps errored. This runs before any file discovery or merging, so the cycle aborts with no on-disk changes; a failed cleanup usually means an fs error on the commit log directory (permissions, I/O) rather than data corruption.

Source

Thrown at adapters/repos/db/vector/hnsw/compact/compactor.go:158

// shouldAbort is polled at safe points (between files, between merged
// nodes); when it returns true, RunCycle aborts and returns
// ErrCompactionAborted. The polls are coarse-grained: a single in-flight
// file conversion or merge step finishes before the abort takes effect,
// which is by design — abandoning a SafeFileWriter mid-Commit could leave
// behind partial output. The atomic-rename pattern (Commit / defer Abort)
// guarantees no source file is deleted unless its replacement was fully
// written, so an abort produces no on-disk regressions: the next cycle
// will pick up where this one left off.
//
// shouldAbort may be nil, in which case the cycle runs to completion.
func (c *Compactor) RunCycle(shouldAbort func() bool) (Action, error) {
	if isAborted(shouldAbort) {
		return ActionNone, ErrCompactionAborted
	}

	// Step 1: Cleanup orphaned temp files and detect overlaps
	if err := c.cleanup(); err != nil {
		return ActionNone, errors.Wrap(err, "cleanup")
	}

	// Step 2: Discover files
	discovery := NewFileDiscoveryWithFS(c.config.Dir, c.fs)
	state, err := discovery.Scan()
	if err != nil {
		return ActionNone, errors.Wrap(err, "file discovery")
	}

	// Step 3: Resolve overlaps (delete contained files)
	if err := c.resolveOverlaps(state); err != nil {
		return ActionNone, errors.Wrap(err, "resolve overlaps")
	}

	// Step 4: Convert raw/condensed files to sorted
	if err := c.convertToSorted(state, shouldAbort); err != nil {
		return ActionNone, errors.Wrap(err, "convert to sorted")
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check permissions and health of the commit log directory and retry — the next cycle re-runs cleanup idempotently
  2. Remove stale *.tmp files manually if the process lacks rights to do so
  3. Look for concurrent processes (backup, antivirus) holding or creating files in the directory
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at adapters/repos/db/vector/hnsw/compact/compactor.go:158 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/466f1c81e863380c. Report an issue: GitHub.