# \`pg create --fork-from\` has stopped working on database, both locally and on CI/CD

**URL:** <https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057>\
**Category:** Build debugging\
**Tags:** postgres, machines\
**Created:** [August 27, 2023, 7:31pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057 "2023-08-27T19:31:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 27, 2023, 7:31pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/1 "2023-08-27T19:31:21Z")

</div>

Hello,

For quite some time, I had been happily using the `--fork-from` flag to automatically provision a staging copy of my database for review apps in an automated GitHub Actions context. Unfortunately, about a month ago, some careless scripting on my end led to said workflow destroying all of my apps, the database included. Luckily, I had retained a few of my own dumps so only a less-than-disastrous amount of data was lost, and I thought that simply recreating the app and re-attaching the relevant consumer apps would mean that all would continue just fine.

Unfortunately, since on or about that day, the workflow has been a lot more delicate than I’d like for reasons seemingly out of my control, and since the beginning of August I’ve been completely unable to fork from the production database for any reason or in any context. The most common error message I get is:

```auto
Error: failed to fork volume: failed to create volume: source volume not found

```

Given that I started noticing this error around the time of [other platform-related incidents](https://status.flyio.net/incidents/7jfyczcvr3tx), I originally thought I’d simply have to wait out the storm and see if anything changed. However, I’ve had no luck since; not with changing the `FLY_REGISTRY_HOST` flag nor any combination of machines and volumes and snapshots and regions. The only thing I’ve admittedly yet to try is tearing down the prod DB app and starting anew, but I’d really prefer to avoid downtime like that, especially if I have no guarantee that I’ll be able to get things running again.

I’ve searched these forums endlessly looking for any similar errors, but haven’t been successful so far. I’m a little nervous about this Discourse’s 7-day necro window, so hopefully I can get some support before the thread closes. I’m of course happy to supply any logs, configs, etc. that are necessary to assist.

---

<div class="post-metadata">

**Author:** ![redjonzaci](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/redjonzaci/32/14794_2.png) [@redjonzaci](https://community.fly.io/u/redjonzaci)\
**Post date:** [August 27, 2023, 9:40pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/2 "2023-08-27T21:40:06Z")

</div>

There have been some changes in that part of the CLI on [use flaps api for volumes #2631](https://github.com/superfly/flyctl/pull/2631).

It seems to me that the `--fork-from` value isn’t being passed properly after the changes made in [flypg/launcher.go](https://github.com/superfly/flyctl/pull/2631/files#diff-718004f81b0559abdaabc50968dcff4a4a541c35d485004461815e480891c486L187).

My diagnosis may not be correct, but if that is the issue, I think it can be fixed quite easily by the owning team.

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [August 28, 2023, 1:51pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/3 "2023-08-28T13:51:38Z")

</div>

@oliver-daniel Mind sending me the name of your app?

---

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 28, 2023, 2:03pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/4 "2023-08-28T14:03:42Z")

</div>

Hey @shaun, happily. Is there a more private method by which I can do that? I don’t have a strong business need to keep the app name private, though I might send it here and then remove my comment once you’ve got it just in case.

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [August 28, 2023, 2:10pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/5 "2023-08-28T14:10:06Z")

</div>

Feel free to send it as a DM.

---

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 28, 2023, 2:17pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/6 "2023-08-28T14:17:38Z")

</div>

Hi, I’m having a little trouble doing that. I see a bunch of notifications coming in that seem to indicate I have some new features available, but the “Private Message” button yet eludes me. 😅 Thanks for your help!

---

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 28, 2023, 2:25pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/7 "2023-08-28T14:25:38Z")

</div>

Awesome, sent.

---

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 28, 2023, 8:32pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/8 "2023-08-28T20:32:44Z")

</div>

Continuing the conversation here 🙂

> Hey there,
> 
> When you specify `--fork-from` could you try using the following format:
> 
> ```auto
> --fork-from <app-name>:<volume-id>
> 
> ```

I should have specified that I have tried this. With each volume shown under `fly vol list` and the following command, I get the same output:

```bash
fly apps destroy <new-app-name> --yes; fly postgres create --name <new-app-name> --fork-from <app-name>:<volume-id> --vm-size shared-cpu-1x

>> Creating postgres cluster in organization personal
Creating app...
Setting secrets on app <new-app-name>...
Provisioning 1 of 1 machines with image registry-1.docker.io/flyio/postgres-flex:15.3@sha256:<digest>
Error: failed to fork volume: failed to create volume: source volume not found

```

---

<div class="post-metadata">

**Author:** ![redjonzaci](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/redjonzaci/32/14794_2.png) [@redjonzaci](https://community.fly.io/u/redjonzaci)\
**Post date:** [August 28, 2023, 10:01pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/9 "2023-08-28T22:01:35Z")

</div>

I was able to reproduce this, but what I thought was a problem in the code, was really a feature. So at this point, the error seems to happen in the API, which is beyond my current reach.

I wonder why it doesn’t find the source volume.

@oliver-daniel you could try running the CLI with `LOG_LEVEL=debug` in front of the command, like `LOG_LEVEL=debug fly postgres create ...` to see the API requests and responses. But other than that, hope the team helps you solve it.

Sorry I couldn’t be more helpful!

---

<div class="post-metadata">

**Author:** ![redjonzaci](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/redjonzaci/32/14794_2.png) [@redjonzaci](https://community.fly.io/u/redjonzaci)\
**Post date:** [August 28, 2023, 10:31pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/10 "2023-08-28T22:31:03Z")

</div>

I also tried with a couple more volume IDs from different apps, but same error.  
Even though when I use the GET endpoint of the Fly Machines API, it finds the volume with that same volume ID.

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [August 28, 2023, 10:53pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/11 "2023-08-28T22:53:32Z")

</div>

We discovered the issue and are working on a fix!

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [August 29, 2023, 6:01pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/12 "2023-08-29T18:01:34Z")

</div>

@oliver-daniel Mind giving the fork another go?

---

<div class="post-metadata">

**Author:** ![oliver-daniel](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oliver-daniel/32/14785_2.png) [@oliver-daniel](https://community.fly.io/u/oliver-daniel)\
**Post date:** [August 31, 2023, 11:16pm UTC](https://community.fly.io/t/pg-create-fork-from-has-stopped-working-on-database-both-locally-and-on-ci-cd/15057/13 "2023-08-31T23:16:39Z")

</div>

Hey Shaun, I’m happy to say that it does seem that the forking issue has been resolved. I’m currently wrangling some other Fly-related issues, but I’m not sure how much those are going to be related to this specific API issue.

Thanks for the help and keeping me updated!
