dgraph-io/dgraph · error

found a manifest with backup number %d but expected %d

Error message

found a manifest with backup number %d but expected %d

What it means

verifyManifests walks the manifests from newest to oldest, expecting BackupNum to decrease by exactly 1 each step down to 1. This error is thrown when a manifest's BackupNum does not equal the expected descending counter, meaning a manifest is missing, duplicated, or out of order in the backup series.

Source

Thrown at worker/backup_manifest.go:44

		return nil
	}

	lastIndex := len(manifests) - 1
	if manifests[lastIndex].BackupNum != 1 {
		return errors.Errorf("expected a BackupNum value of 1 for first manifest but got %d",
			manifests[lastIndex].BackupNum)
	}

	backupId := manifests[lastIndex].BackupId
	backupNum := uint64(len(manifests))
	for _, manifest := range manifests {
		if manifest.BackupId != backupId {
			return errors.Errorf("found a manifest with backup ID %s but expected %s",
				manifest.BackupId, backupId)
		}

		if manifest.BackupNum != backupNum {
			return errors.Errorf("found a manifest with backup number %d but expected %d",
				manifest.BackupNum, backupNum)
		}
		backupNum--
	}

	return nil
}

func getManifestsToRestore(h UriHandler, uri *url.URL, req *pb.RestoreRequest) ([]*Manifest, error) {
	manifest, err := GetManifest(h, uri)
	if err != nil {
		return nil, err
	}
	manifests := manifest.Manifests

	// filter takes a list of manifests and returns the list of manifests
	// that should be considered during a restore.
	filter := func(mfs []*Manifest, backupId string) ([]*Manifest, error) {

View on GitHub (pinned to 759e242be6)

Solutions

  1. Restore the missing/reordered manifest file so the numbering is contiguous.
  2. Re-copy the whole backup set from its original location.
  3. Take a fresh full backup and use that as the restore source.
  4. Audit the backup directory for duplicate or renamed manifest files.

Example fix

// before: manifests numbered 3,2,0 (missing 1)
// after: restore manifest file with BackupNum 1 into the backup dir
aws s3 cp s3://original/manifest-1 s3://bucket/backup/manifest-1
Defensive patterns

Strategy: validation

Validate before calling

expected := len(manifests)
for _, m := range manifests {
    if int(m.BackupNum) != expected {
        return fmt.Errorf("chain broken: got BackupNum %d, want %d", m.BackupNum, expected)
    }
    expected--
}

Type guard

func isContiguousChain(m []Manifest) bool {
    for i, v := range m {
        if int(v.BackupNum) != len(m)-i {
            return false
        }
    }
    return true
}

Prevention

When it happens

Trigger: verifyRequest walks manifests where any element's BackupNum != expected descending value — e.g. a missing manifest-N file between the full backup and the latest incremental, or duplicated/reordered files in the backup directory.

Common situations: Deleted single manifest file breaks the chain; manually renamed manifest files; restore directory assembled by hand; object-store listing returning duplicates.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/633f718d973a8bc2. Report an issue: GitHub.