hashicorp/nomad · error

failed to get destination last index: %w

Error message

failed to get destination last index: %w

What it means

Fires in verifyMigration when querying LastIndex on the destination WAL store fails; the copy may have been incomplete, and without the destination range the data cannot be validated.

Source

Thrown at helper/raftutil/migrate.go:269

	// 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 {
		srcVal, err := src.GetUint64([]byte(key))
		if err != nil {
			return fmt.Errorf("failed to get source uint64 key %s: %w", key, err)
		}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify disk space did not run out mid-copy
  2. Re-run the migration from the preserved BoltDB source after removing the incomplete WAL directory
  3. Check WAL file integrity and permissions on the destination
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at helper/raftutil/migrate.go:269 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/3ed0faa9b0db2db3. Report an issue: GitHub.