dgraph-io/dgraph · error

expected a BackupNum value of 1 for first manifest but got %

Error message

expected a BackupNum value of 1 for first manifest but got %d

What it means

verifyManifests checks a list of backup manifests before a restore or verification. Backup manifests are stored newest-first conceptually: the last manifest in the slice must have BackupNum == 1 (the oldest, full backup). This error is thrown when the manifest expected to be the oldest backup has a BackupNum other than 1, meaning the manifest sequence is incomplete, reordered, or corrupted.

Source

Thrown at worker/backup_manifest.go:31

	"sort"
	"strings"
	"time"

	"github.com/golang/glog"
	"github.com/pkg/errors"

	"github.com/dgraph-io/dgraph/v25/protos/pb"
	"github.com/dgraph-io/dgraph/v25/x"
)

func verifyManifests(manifests []*Manifest) error {
	if len(manifests) == 0 {
		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--
	}

View on GitHub (pinned to 759e242be6)

Solutions

  1. Ensure all manifest files from the original backup are present and unmodified in the backup location.
  2. Do not delete or reorder manifest-N files; the full chain ending with BackupNum 1 must exist.
  3. Re-run a complete backup into a fresh location and restore from that.
  4. Verify the URI handler is listing paths from the correct backup root (no partial path prefix).

Example fix

// before: only some manifests copied
// s3://backup/dgraph.1, dgraph.2 present, dgraph (num 1) missing
// after: copy the entire backup set
aws s3 sync s3://backup/ s3://newbucket/dgraph-backup/ --exact-timestamps
Defensive patterns

Strategy: validation

Validate before calling

manifests, _ := listManifests(uri)
if len(manifests) > 0 && manifests[len(manifests)-1].BackupNum != 1 {
    return fmt.Errorf("backup set incomplete: oldest manifest BackupNum=%d, want 1", manifests[len(manifests)-1].BackupNum)
}

Type guard

func isOldestFirst(m []Manifest) bool {
    return len(m) > 0 && m[len(m)-1].BackupNum == 1
}

Prevention

When it happens

Trigger: Calling verifyRequest/verifyManifests with a manifests slice whose last element (in storage order) has BackupNum != 1 — e.g. after manually copying/deleting manifest files from the backup location, uploading only part of a backup, or listing manifests in the wrong order.

Common situations: Partial backups restored into a new bucket; users deleting what look like 'old' manifest files; manually renamed/copied backup directories; backup storage truncated by lifecycle policies.

Related errors


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