Skip to content

Sometimes a SQLITE_DONE exception is thrown with DELETE when using better-sqlite3 and sqlite-vec >=0.1.7 #274

@Skywalker13

Description

@Skywalker13

Hello,

Since the v0.1.7 (v0.1.8 too) and better-sqlite3, we are facing (sometimes, 1% or less, I don't know exactly) to SQLITE_DONE exceptions when deleting rows in the vec table. I'm not able to create a small project where this problem appears, but maybe someone else encounters the same problem?!

Our table:

CREATE VIRTUAL TABLE IF NOT EXISTS embeddings USING vec0(
  locale TEXT partition key,
  scope TEXT,
  documentId TEXT,
  +chunkId TEXT,
  +chunk TEXT,
  embedding ${type}[${dimensions}] distance_metric=cosine
);

Query that producing sometimes these exception:

DELETE FROM embeddings
WHERE documentId = $documentId;
code=SQLITE_DONE: SqliteError: no more rows available

We must wrap the delete queries in a code like that:

  try {
    run();
  } catch (ex) {
    if (ex.code !== 'SQLITE_DONE') {
      throw ex;
    }
  }

That looks very strange, SQLITE_DONE should never produce exception and it's very difficult to reproduce. It's a new problem because the same codebase with 0.1.7-alpha.2 is working as expected.

Regards,
Mathieu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions