pscale "database branch ... not found" in CI
pscale looked up the branch by name in the given database and org and found nothing. Usually the branch-per-PR create step did not run first, the name is wrong, or the command targets a different database than the one that holds the branch.
What this error means
A "pscale branch" or "pscale connect" command fails with "database branch pr-123 not found in database app". It typically means the create step was skipped or the names disagree.
Error: database branch "pr-123" does not exist in database "app" (organization "my-org")Common causes
The branch was not created before it was used
A connect or deploy-request step ran before the branch-create step, or the create step failed, so the branch does not exist yet.
Wrong database or org
The command names a different database or organization than the one where the branch lives, so the lookup misses.
How to fix it
Create the branch first, then use it
- Run
pscale branch createfor the PR branch before any step that references it. - Use a deterministic branch name tied to the PR number.
- Delete the branch on PR close to keep the list clean.
pscale branch create app "pr-${{ github.event.number }}" --org "$PLANETSCALE_ORG"Confirm the database and org match
List branches for the exact database and org to verify the name and target before connecting.
pscale branch list app --org "$PLANETSCALE_ORG"How to prevent it
- Create the per-PR branch before any step that reads it.
- Use one deterministic branch name per PR across all steps.
- Always pass the same database and org to related pscale commands.