{"record":{"id":"864296b4e26057f3","repo":"dgraph-io/dgraph","slug":"cannot-parse-backup-location","errorCode":null,"errorMessage":"cannot parse backup location","messagePattern":"cannot parse backup location","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/online_restore.go","lineNumber":241,"sourceCode":"\t\t}\n\t\tif err := groups().Node.applyMutations(ctx, &dropProposal); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO: after the drop, the tablets for the predicates stored in this group's\n\t// backup could be in a different group. The tablets need to be moved.\n\n\t// Reset tablets and set correct tablets to match the restored backup.\n\tcreds := &x.MinioCredentials{\n\t\tAccessKey:    req.AccessKey,\n\t\tSecretKey:    req.SecretKey,\n\t\tSessionToken: req.SessionToken,\n\t\tAnonymous:    req.Anonymous,\n\t}\n\turi, err := url.Parse(req.Location)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"cannot parse backup location\")\n\t}\n\thandler, err := NewUriHandler(uri, creds)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"cannot create backup handler\")\n\t}\n\n\tmanifests, err := getManifestsToRestore(handler, uri, req)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"cannot get backup manifests\")\n\t}\n\n\t// filter manifests that needs to be restored\n\tmfsToRestore := manifests[:0]\n\tfor _, m := range manifests {\n\t\tif (req.BackupNum == 0 || m.BackupNum <= req.BackupNum) &&\n\t\t\t(req.IncrementalFrom == 0 || m.BackupNum >= req.IncrementalFrom) {\n\n\t\t\tmfsToRestore = append(mfsToRestore, m)","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/online_restore.go#L223-L259","documentation":"Wrapped by handleRestoreProposal (worker/online_restore.go:241). The restore location string supplied in the RestoreRequest is parsed with url.Parse; this error wraps the parse failure, meaning the location is not a valid URI for a backup source (e.g. s3://, minio://, gcs://, file path).","triggerScenarios":"Calling /restore with location containing spaces or illegal characters, a bare Windows path (C:\\backups), a location with an unsupported/malformed scheme, or an unescaped fragment/query.","commonSituations":"Copy-pasted S3 paths with trailing whitespace; storing the location in YAML/Helm values where special characters break quoting; switching from an old --restore_from style path to the URI form; Windows-style paths on Linux Alphas.","solutions":["Validate the location is a well-formed URI, e.g. url.Parse it in a script before calling restore.","Use the correct scheme form: s3://bucket/folder, minio://host:port/bucket, gcs://bucket/folder, or /absolute/path for filesystem backups.","Percent-encode or remove spaces/special characters in bucket/folder names.","Fix quoting/escaping in Helm/env config where the location value is templated."],"exampleFix":"// before\n{\"location\": \"C:\\backups\\full\"}\n// after\n{\"location\": \"/mnt/backups/full\"}\n// or\n{\"location\": \"s3://my-bucket/dgraph-backups\"}","handlingStrategy":"validation","validationCode":"// Validate the backup location URI before calling restore\nu, err := url.Parse(location)\nif err != nil || u.Scheme == \"\" && !filepath.IsAbs(location) {\n    return fmt.Errorf(\"invalid backup location: %q\", location)\n}","typeGuard":"func isValidBackupLocation(loc string) bool {\n    u, err := url.Parse(loc)\n    if err != nil {\n        return false\n    }\n    switch u.Scheme {\n    case \"s3\", \"minio\", \"gcs\", \"azure\", \"file\", \"\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Use absolute POSIX paths or scheme-based URIs (s3://, minio://, gcs://).","Never use Windows-style paths on Linux Alphas.","Trim whitespace and escape special characters in bucket/prefix names.","Test the location with `dgraph backup` list tooling or an object-store listing first."],"tags":["dgraph","restore","uri","configuration"],"backgroundTag":"invalid-backup-uri","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}