# libSQL error codes

> libSQL and Turso errors explained: SQLite result codes on local files, Hrana and HTTP errors from remote servers, auth tokens, replicas and rate limits.

Source: https://sqlly.app/errors/libsql
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

libSQL is a fork of SQLite, so errors on a local file are the same SQLite result codes. Remote databases (Turso Cloud or a self-hosted sqld) talk the Hrana protocol over HTTP, so failures arrive as HTTP status codes and server error messages instead. Both shapes are listed here.

## Reading a libSQL error

On a local file or embedded replica, libSQL reuses SQLite result codes, so you see things like `SQLITE_BUSY: database is locked`. Look those up in the SQLite catalog too.

Against a remote server, the client reports `SERVER_ERROR: Server returned HTTP status ...` and the body carries the server's own message. The HTTP status is often the most reliable part.

Turso Cloud adds platform errors on top: expired auth tokens (401), permission limits (403), missing databases (404), and request-rate limits (429).

The Turso CLI (`turso db tokens create`, `turso db show`) reports its own errors when a name or organization does not exist.

## Authentication and tokens

- [`401 Unauthorized`](https://sqlly.app/errors/libsql/unauthorized-401): 401 Unauthorized: bad or missing auth token
- [`403 Forbidden`](https://sqlly.app/errors/libsql/forbidden-403): 403 Forbidden: no permission for this resource
- [`auth token expired`](https://sqlly.app/errors/libsql/token-expired): Auth token expired
- [`no organization`](https://sqlly.app/errors/libsql/cli-no-organization): turso CLI: no organization

## Remote server and Hrana errors

- [`404 Not Found`](https://sqlly.app/errors/libsql/database-not-found-404): 404 Not Found: unknown database or endpoint
- [`429 Too Many Requests`](https://sqlly.app/errors/libsql/rate-limited-429): request rate limit hit
- [`connection reset / interrupted`](https://sqlly.app/errors/libsql/connection-interrupted): Connection reset or dropped
- [`too many connections`](https://sqlly.app/errors/libsql/too-many-connections): Too many connections to one database
- [`Transaction timed-out`](https://sqlly.app/errors/libsql/interactive-transaction-aborted): interactive transaction aborted
- [`Error in remote response`](https://sqlly.app/errors/libsql/error-in-remote-response): Error in remote response
- [`500 Internal Server Error`](https://sqlly.app/errors/libsql/internal-server-error-500): server failed on a valid request
- [`402 Payment Required`](https://sqlly.app/errors/libsql/payment-required-402): 402 Payment Required
- [`409 Conflict`](https://sqlly.app/errors/libsql/conflict-409): 409 Conflict
- [`database not found`](https://sqlly.app/errors/libsql/cli-database-not-found): turso CLI: database not found
- `socket closed unexpectedly`: Hrana socket closed

## Replicas and consistency

- [`SQLITE_BUSY: database is locked`](https://sqlly.app/errors/libsql/embedded-replica-locked) (5): embedded replica file locked
- [`replica out of date`](https://sqlly.app/errors/libsql/replica-paused): stale reads from a failing replica

## Local SQLite errors

- [`SQLITE_BUSY`](https://sqlly.app/errors/libsql/busy) (5): SQLITE_BUSY: the database is busy
- [`SQLITE_AUTH`](https://sqlly.app/errors/libsql/sqlite-auth) (23): SQLITE_AUTH: authorization denied

Codes and messages are from the [libSQL / Turso documentation](https://docs.turso.tech/).
