hashicorp/nomad · error

failed to get source first index: %w

Error message

failed to get source first index: %w

What it means

Fires in verifyMigration after copying data: querying FirstIndex on the source (BoltDB-backed) raft log store failed, so the post-migration sanity check of the source log could not even be performed.

Source

Thrown at helper/raftutil/migrate.go:254

		if err := os.RemoveAll(walDir); err == nil {
			return
		}
	}
}

// verifyMigration performs sanity checks on the migrated data.
// src and dst should implement both LogStore and StableStore interfaces.
func verifyMigration(src interface {
	raft.LogStore
	raft.StableStore
}, dst interface {
	raft.LogStore
	raft.StableStore
}) error {
	// Verify log index ranges match.
	srcFirst, err := src.FirstIndex()
	if err != nil {
		return fmt.Errorf("failed to get source first index: %w", err)
	}

	srcLast, err := src.LastIndex()
	if err != nil {
		return fmt.Errorf("failed to get source last index: %w", err)
	}

	dstFirst, err := dst.FirstIndex()
	if err != nil {
		return fmt.Errorf("failed to get destination first index: %w", err)
	}

	dstLast, err := dst.LastIndex()
	if err != nil {
		return fmt.Errorf("failed to get destination last index: %w", err)
	}

	if srcFirst != dstFirst {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check server logs for underlying BoltDB file corruption or I/O errors
  2. Restore the raft store from a snapshot and re-run the migration
  3. Keep the original BoltDB files until verification passes; they are needed for rollback
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at helper/raftutil/migrate.go:254 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/bd4fc81061bcf6a4. Report an issue: GitHub.