dgraph-io/dgraph · error

while creating backup directory

Error message

while creating backup directory

What it means

ProcessBackupRequest ensures the destination directory exists at the backup URI before writing. If handler.DirExists("./") reports the directory missing and handler.CreateDir("./") then fails (permissions, bucket missing, storage backend error), the error is wrapped with this message.

Source

Thrown at worker/backup.go:278

		glog.Errorf("Unable to retrieve readonly timestamp for backup: %s", err)
		return err
	}

	req.ReadTs = ts.ReadOnly
	req.UnixTs = time.Now().UTC().Format("20060102.150405.000")

	// Read the manifests to get the right timestamp from which to start the backup.
	uri, err := url.Parse(req.Destination)
	if err != nil {
		return err
	}
	handler, err := NewUriHandler(uri, GetCredentialsFromRequest(req))
	if err != nil {
		return err
	}
	if !handler.DirExists("./") {
		if err := handler.CreateDir("./"); err != nil {
			return errors.Wrap(err, "while creating backup directory")
		}
	}
	latestManifest, err := GetLatestManifest(handler, uri)
	if err != nil {
		return err
	}

	req.SinceTs = latestManifest.ValidReadTs()
	// To force a full backup we'll set the sinceTs to zero.
	if req.ForceFull {
		req.SinceTs = 0
	} else {
		if err := checkBackupReadTsAdvanced(latestManifest, req.ReadTs); err != nil {
			return err
		}

		if x.WorkerConfig.EncryptionKey != nil {
			// If encryption key given, latest backup should be encrypted.

View on GitHub (pinned to 759e242be6)

Solutions

  1. Check the wrapped inner error for the storage backend's root cause
  2. Verify the backup URI (bucket/path) is correct and the bucket exists
  3. Confirm credentials have write/CreateDir permissions on the destination
  4. Pre-create the destination directory/bucket manually, then re-run the backup
Defensive patterns

Strategy: validation

Validate before calling

handler, err := NewUriHandler(u, creds)
if err != nil { return err }
if !handler.DirExists("./") {
    if err := handler.CreateDir("./"); err != nil {
        return fmt.Errorf("pre-check: cannot create backup dir at %s: %w", u, err)
    }
}

Try / catch

err := ProcessBackupRequest(ctx, req)
if err != nil && strings.Contains(err.Error(), "while creating backup directory") {
    // check URI validity, bucket existence, and write permissions before retry
}

Prevention

When it happens

Trigger: Running a backup to a URI whose target directory does not yet exist and the storage handler cannot create it — e.g. S3/MinIO bucket missing, wrong access keys lacking PutObject/CreateDir permission, or an invalid filesystem path.

Common situations: S3 bucket name typo; IAM credentials without write permission to the prefix; s3:// or minio:// URI malformed; local filesystem path on a read-only volume; running container without write access to the mounted path.

Related errors


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