ipfs/kubo · error

batch deleting orphaned key %s: %w

Error message

batch deleting orphaned key %s: %w

What it means

Fired by purgeOrphanedKeystoreData when an individual batch.Delete of an orphaned keystore record fails. The orphaned key is identified in the message; the cleanup pass stops at the first failing delete to avoid silently skipping records.

Source

Thrown at core/node/provider.go:572

	defer results.Close()

	var batch datastore.Batch
	var count, pending int
	for result := range results.Next() {
		if ctx.Err() != nil {
			return ctx.Err()
		}
		if result.Error != nil {
			return fmt.Errorf("iterating orphaned keystore data: %w", result.Error)
		}
		if batch == nil {
			batch, err = ds.Batch(ctx)
			if err != nil {
				return fmt.Errorf("creating batch for orphaned keystore cleanup: %w", err)
			}
		}
		if err := batch.Delete(ctx, datastore.NewKey(result.Key)); err != nil {
			return fmt.Errorf("batch deleting orphaned key %s: %w", result.Key, err)
		}
		count++
		pending++
		if pending >= purgeBatchSize {
			if err := batch.Commit(ctx); err != nil {
				return fmt.Errorf("committing orphaned keystore cleanup batch: %w", err)
			}
			if err := ds.Sync(ctx, syncKey); err != nil {
				return fmt.Errorf("syncing orphaned keystore cleanup: %w", err)
			}
			batch = nil
			pending = 0
		}
	}
	if pending > 0 {
		if err := batch.Commit(ctx); err != nil {
			return fmt.Errorf("committing orphaned keystore cleanup batch: %w", err)
		}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Restart the daemon to re-run the cleanup; orphan detection is idempotent
  2. Check datastore permissions and disk health
  3. Recurring failures point to datastore corruption; consult docs/datastores.md
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at core/node/provider.go:572 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/699396d49dcfd995. Report an issue: GitHub.