# \`fdbrestore\` with --remove-prefix and --keys fails on error: "begin or end of key range does not start with removePrefix"

**URL:** <https://forums.foundationdb.org/t/fdbrestore-with-remove-prefix-and-keys-fails-on-error-begin-or-end-of-key-range-does-not-start-with-removeprefix/3774>\
**Category:** Using FoundationDB\
**Created:** [January 31, 2023, 12:57am UTC](https://forums.foundationdb.org/t/fdbrestore-with-remove-prefix-and-keys-fails-on-error-begin-or-end-of-key-range-does-not-start-with-removeprefix/3774 "2023-01-31T00:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pratyusharj](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/pratyusharj/32/1508_2.png) [@pratyusharj](https://forums.foundationdb.org/u/pratyusharj)\
**Post date:** [January 31, 2023, 12:57am UTC](https://forums.foundationdb.org/t/fdbrestore-with-remove-prefix-and-keys-fails-on-error-begin-or-end-of-key-range-does-not-start-with-removeprefix/3774/1 "2023-01-31T00:57:21Z")

</div>

When I call fdbrestore with `–keys ‘\x025 \x025\xff’ --remove-prefix ‘\x025’ I get the following failure:

```auto
Assertion restoreRange.begin.startsWith(removePrefix) && restoreRange.end.startsWith(removePrefix)

```

What am I doing incorrectly here? For context what I want to do is restore all of the data from a backup of cluster1 stored under a particular directory (i.e. with the prefix \x025) and remove the prefix before restoring it to a different cluster2 that has a different prefix associated with that same directory.

---

<div class="post-metadata">

**Author:** ![hbs](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/hbs/32/1419_2.png) [@hbs](https://forums.foundationdb.org/u/hbs)\
**Post date:** [August 7, 2023, 5:27am UTC](https://forums.foundationdb.org/t/fdbrestore-with-remove-prefix-and-keys-fails-on-error-begin-or-end-of-key-range-does-not-start-with-removeprefix/3774/2 "2023-08-07T05:27:48Z")

</div>

Did you solve your problem in any way?

It seems that `remove-prefix` and `add-prefix` do not accept escaping in the way `keys` does, so maybe it is the issue with your command.

---

<div class="post-metadata">

**Author:** ![newhook](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/newhook/32/1684_2.png) [@newhook](https://forums.foundationdb.org/u/newhook)\
**Post date:** [April 27, 2024, 2:01pm UTC](https://forums.foundationdb.org/t/fdbrestore-with-remove-prefix-and-keys-fails-on-error-begin-or-end-of-key-range-does-not-start-with-removeprefix/3774/3 "2024-04-27T14:01:33Z")

</div>

We ran into this. This was previously filed as [Many problems about fdbrestore --remove\_prefix · Issue #1537 · apple/foundationdb · GitHub](https://github.com/apple/foundationdb/issues/1537)

I wrote up a quick PR to fix this issue. [Hex decode add-prefix and remove-prefix for fdbrestore. by newhook · Pull Request #11344 · apple/foundationdb · GitHub](https://github.com/apple/foundationdb/pull/11344/files)
