AdguardTeam/AdGuardHome · error

committing transaction: %w

Error message

committing transaction: %w

What it means

bbolt failed to commit the write transaction that persisted removals of expired/invalid sessions during startup load. The commit happened because processSessions removed at least one stale session (removed > 0).

Source

Thrown at internal/aghuser/sessionstorage.go:181

	if bkt == nil {
		return nil
	}

	removed, err := ds.processSessions(ctx, bkt)
	if err != nil {
		return fmt.Errorf("processing sessions: %w", err)
	}

	if removed == 0 {
		ds.logger.DebugContext(ctx, "loading sessions from db", "stored", len(ds.sessions))

		return nil
	}

	needRollback = false
	err = tx.Commit()
	if err != nil {
		return fmt.Errorf("committing transaction: %w", err)
	}

	ds.logger.DebugContext(
		ctx,
		"loading sessions from db",
		"stored", len(ds.sessions),
		"removed", removed,
	)

	return nil
}

// processSessions iterates over the sessions bucket and loads or removes
// sessions as needed.
func (ds *DefaultSessionStorage) processSessions(
	ctx context.Context,
	bkt *bbolt.Bucket,
) (removed int, err error) {

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Check disk space on the volume holding sessions.db (df -h) and free space
  2. Verify the database file still exists and is writable by the service user
  3. If the file was replaced mid-startup, restart the service after the replacement settles
  4. Run filesystem checks if I/O errors persist

Example fix

# before
# df shows 100% on /var
# after
# free space, then restart the service
Defensive patterns

Strategy: retry

Validate before calling

if avail := diskFree(sessionsDir); avail < minRequiredBytes { return fmt.Errorf("low disk: %d free", avail) }

Try / catch

if err := ds.loadSessions(ctx); err != nil {
    if errors.Is(err, syscall.ENOSPC) { free space; retry startup }
}

Prevention

When it happens

Trigger: tx.Commit fails after invalid sessions were deleted: underlying I/O error on the database file (disk full, ENOSPC), file removed underneath the process, or the transaction was already rolled back/closed.

Common situations: Disk-full conditions in the data directory; the sessions file deleted or replaced while the app was starting; hardware/filesystem errors on the volume holding the db.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/d67ffe543dd6713a. Report an issue: GitHub.