Skip to content
Latchkey

turso "database ... not found" in CI

Turso looked up the database by name in your organization and found nothing. When you create a database per PR, this usually means the create step did not run first, the database was already destroyed, or the wrong org is selected.

What this error means

A "turso db show" or a libsql connection using the database URL fails with "database pr-123 not found" or "could not resolve database".

turso
Error: database "pr-123" not found. Run `turso db list` to see your databases.

Common causes

The database was not created before use

A step referenced the per-PR database before turso db create ran, or the create step failed.

It was destroyed by a prior cleanup

A cleanup job already removed the database, but a later step still holds its name or URL.

How to fix it

Create the database per PR, then derive its URL

  1. Create the database with a deterministic per-PR name.
  2. Read its URL and mint a token for the connection.
  3. Destroy it when the PR closes.
Terminal
turso db create "pr-${{ github.event.number }}"
turso db show "pr-${{ github.event.number }}" --url

Destroy the database on PR close

Add a cleanup job so per-PR databases do not accumulate and names are freed.

Terminal
turso db destroy "pr-${{ github.event.number }}" --yes

How to prevent it

  • Create the per-PR database before any step that uses it.
  • Use one deterministic database name per PR across steps.
  • Destroy the database on PR close to avoid leftover state and cost.

Frequently asked questions

What causes "turso "database not found""?
A step referenced the per-PR database before turso db create ran, or the create step failed.
How do I fix turso "database not found"?
Create the database per PR, then derive its URL

Related guides

References

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