Skip to content
Latchkey

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.

pscale
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

  1. Run pscale branch create for the PR branch before any step that references it.
  2. Use a deterministic branch name tied to the PR number.
  3. Delete the branch on PR close to keep the list clean.
Terminal
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.

Terminal
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.

Frequently asked questions

What causes "pscale "branch not found""?
A connect or deploy-request step ran before the branch-create step, or the create step failed, so the branch does not exist yet.
How do I fix pscale "branch not found"?
Create the branch first, then use it

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card