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".
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
- Create the database with a deterministic per-PR name.
- Read its URL and mint a token for the connection.
- Destroy it when the PR closes.
turso db create "pr-${{ github.event.number }}"
turso db show "pr-${{ github.event.number }}" --urlDestroy the database on PR close
Add a cleanup job so per-PR databases do not accumulate and names are freed.
turso db destroy "pr-${{ github.event.number }}" --yesHow 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.