// libSQL error reference

Transaction timed-out: interactive transaction aborted

Interactive transactions fail on clients or servers old enough to predate Hrana-over-HTTP streams, or when the server expires an idle stream; batches still work.

오류
Transaction timed-out
카테고리
Remote server and Hrana errors
오류 메시지
interactive transaction not allowed in HTTP queries

의미

Older sqld versions refused interactive transactions on stateless HTTP requests with exactly this message; current clients open a stream over HTTP (baton streams) and db.transaction() works with https:// URLs. The failure is still real in three shapes: a pinned old client or server, a literal BEGIN sent as a pipeline statement, and interactive transactions left idle until the server expires the stream (The stream has expired due to inactivity) or times the transaction out (Transaction timed-out).

일반적인 원인

  • A client or server old enough to predate Hrana-over-HTTP streams.
  • A literal BEGIN (또는 COMMIT) sent as a statement through a pipeline request.
  • An interactive transaction held open so long the server expired or timed it out.

Find the cause

Check the client version and URL scheme first: an up-to-date client on `https://` supports transactions, so the refusal points at a pinned old dependency. A bare `BEGIN` in a pipeline is refused or strands state, so use the transaction API or a batch. If the transaction worked and then died, the server expired the idle stream; keep interactive transactions short.

해결 방법

  1. Upgrade the client first. Current @libsql/client runs db.transaction() over https URLs; long interactive sessions still do best on a WebSocket (libsql://) connection:

    const db = createClient({ url: 'libsql://mydb-myorg.turso.io', authToken });
    const tx = await db.transaction('write');
  2. On HTTP-only clients, replace the transaction with a batch, which is atomic on the server:

    await db.batch([
      { sql: 'UPDATE accounts SET bal = bal - 10 WHERE id = 1', args: [] },
      { sql: 'UPDATE accounts SET bal = bal + 10 WHERE id = 2', args: [] }
    ], 'write');
  3. Never send BEGIN/COMMIT yourself over HTTP:

    -- wrong over https:// URLs
    -- BEGIN;
    -- UPDATE ...;
    -- COMMIT;

Other ways to handle it

db.batch() runs all statements atomically on the server and works over any connection; for logic that decides statements mid-flight, keep the interactive transaction short or move the decision into one SQL statement with CTEs.

안전하게 재현하세요

Local and honest for the idle-stream shape: run `turso dev --db-file scratch.db`, open a transaction over any URL scheme with @libsql/client, and wait past the server's inactivity expiry; the next statement fails with the stream expired error. The legacy refusal itself only reproduces on an old pinned client or server version.

질문

Can I use db.transaction() with an https:// URL in @libsql/client?

Yes in current versions: the HTTP client opens a server-side stream and the transaction runs on it. Very old client or server versions refused interactive transactions over HTTP; if you see that refusal, upgrade before restructuring code.

Why did my interactive transaction die after a pause?

The server expires idle streams (The stream has expired due to inactivity) and times out stale transactions (Transaction timed-out). Keep interactive transactions short, or express the work as a batch, which commits or rolls back as a unit.

Can I send BEGIN and COMMIT as plain statements over HTTP?

No. Over HTTP each pipeline request should be self-contained; use the client's transaction API or db.batch(), which run inside an implicit server-side transaction.

관련 오류

More remote server and hrana errors errors

코드와 메시지 텍스트의 출처는 다음과 같습니다 libSQL / Turso documentation. 전체 목록은 libSQL error list 또는 모든 데이터베이스 오류 검색.

// 오류는 줄이고, 수정은 빠르게

Work on libSQL in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for libSQL and the other databases you use.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.