dgraph-io/dgraph · error

not enough backups to restore manifest with backupNum %d

Error message

not enough backups to restore manifest with backupNum %d

What it means

getManifestsToRestore selects the last N manifests (N = req.BackupNum) for a restore. This error is thrown when fewer manifests exist in the location than the requested BackupNum, i.e. the user asked to restore more backups than are available in the backup directory.

Source

Thrown at worker/backup_manifest.go:110

				glog.Warningf("backup file [%v] missing for backupId [%v] and backupNum [%v]",
					path, m.BackupId, m.BackupNum)
				missingFiles = true
				break
			}
		}
		if !missingFiles {
			validManifests = append(validManifests, m)
		}
	}

	manifests, err = filter(validManifests, req.BackupId)
	if err != nil {
		return nil, err
	}

	if req.BackupNum > 0 {
		if len(manifests) < int(req.BackupNum) {
			return nil, errors.Errorf("not enough backups to restore manifest with backupNum %d",
				req.BackupNum)
		}
		manifests = manifests[len(manifests)-int(req.BackupNum):]
	}
	return manifests, nil
}

// getConsolidatedManifest walks over all the backup directories and generates a master manifest.
func getConsolidatedManifest(h UriHandler, uri *url.URL) (*MasterManifest, error) {
	// If there is a master manifest already, we just return it.
	if h.FileExists(backupManifest) {
		manifest, err := readMasterManifest(h, backupManifest)
		if err != nil {
			return &MasterManifest{}, errors.Wrap(err, "failed to read master manifest: ")
		}
		return manifest, nil
	}

View on GitHub (pinned to 759e242be6)

Solutions

  1. Lower the requested backup-num to at most the number of manifests present.
  2. Check the backup location and list how many manifest files exist.
  3. Restore the missing older backup parts into the same location.
  4. Run a fresh full backup plus needed increments if the chain cannot be recovered.

Example fix

// before
dgraph restore --dst s3://bucket/backup --backup-num 10
# only 3 manifests exist
// after
dgraph restore --dst s3://bucket/backup --backup-num 3
Defensive patterns

Strategy: validation

Validate before calling

if req.BackupNum > 0 {
    n := countManifests(uri)
    if int(req.BackupNum) > n {
        return fmt.Errorf("requested %d backups but only %d manifests exist", req.BackupNum, n)
    }
}

Type guard

func hasEnoughBackups(reqNum uint64, manifests []Manifest) bool {
    return reqNum == 0 || uint64(len(manifests)) >= reqNum
}

Prevention

When it happens

Trigger: Calling restore (RunMapper/handleRestoreProposal/verifyRequest) with --backup-num N (or RestoreRequest.BackupNum = N) when the manifest list at the URI has fewer than N entries.

Common situations: User sets -j/--backup-num larger than the number of increments actually taken; lifecycle policies pruned old manifests; pointing restore at a directory that holds only a subset of backups.

Related errors


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