hashicorp/nomad · error

failed to get destination first index: %w

Error message

failed to get destination first index: %w

What it means

Fires in verifyMigration when querying FirstIndex on the destination WAL store fails right after the copy; the freshly written WAL may be corrupt or unreadable, so verification aborts.

Source

Thrown at helper/raftutil/migrate.go:264

	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 {
		return fmt.Errorf("first index mismatch: source=%d, destination=%d", srcFirst, dstFirst)
	}

	if srcLast != dstLast {
		return fmt.Errorf("last index mismatch: source=%d, destination=%d", srcLast, dstLast)
	}

	// Verify stable store uint64 keys.
	uint64Keys := []string{"CurrentTerm", "LastVoteTerm"}
	for _, key := range uint64Keys {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check permissions on the new WAL directory and files
  2. Inspect server logs for WAL read errors indicating a truncated write
  3. Delete the partial WAL directory and retry the migration from the intact BoltDB source
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at helper/raftutil/migrate.go:264 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/8f9daa642a500220. Report an issue: GitHub.