tursodatabase / tursodatabase/libsql-js

"Invalid header bit ..." when using Embedded Replica

Open
#157 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
335
Forks
48
Avg merge
3d 2h
Merged PRs (30d)
3

Description

I'm using an Embedded Replica, and every now and then I see the following when executing writes against the Embedded Database (I'm the only writer):

2024-12-25T21:56:29.247927Z ERROR tower_http::trace::on_failure: response failed classification=Error: status: Internal, message: "Invalid header bit 117 expected 0 or 1", details: [], metadata: MetadataMap { headers: {} } latency=0 ms
291 |    * Executes the SQL statement and returns an info object.
292 |    */
293 |   run(...bindParameters) {
294 |     try {
295 |       if (bindParameters.length == 1 && typeof bindParameters[0] === "object") {
296 |         return statementRun.call(this.stmt, bindParameters[0]);
                                  ^
error: Replication(Client(Status { code: Internal, message: "Invalid header bit 117 expected 0 or 1", source: None }))
      at run ($HOME/project/node_modules/libsql/index.js:296:29)
      at executeStmt ($HOME/project/node_modules/@libsql/client/lib-esm/sqlite3.js:270:34)
      at execute ($HOME/project/node_modules/@libsql/client/lib-esm/sqlite3.js:67:19)
      at $HOME/project/node_modules/@libsql/kysely-libsql/lib-esm/index.js:70:37
      at executeQuery ($HOME/project/node_modules/@libsql/kysely-libsql/lib-esm/index.js:68:24)
      at $HOME/project/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:35:45
      at $HOME/project/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:52
      at $HOME/project/node_modules/kysely/dist/esm/driver/default-connection-provider.js:10:26

Not entirely sure if this issue belongs here since I'm using Turso via the JS client, or in the libsql repo (or in the @libsql/kysely-libsql repo for that matter). It does seems to surface a Rust error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at node_modules/libsql/index.js:296 and trace the failing run call through @libsql/client/lib-esm/sqlite3.js and the Embedded Replica replication path. Determine whether the Rust error originates in libsql-js, the client, or another repository, then establish a reproducible case and verify that writes no longer produce the invalid header-bit error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, sqlite
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.