Skip to content

Import worker uses empty SQLite database instead of migrated database (SqliteError: no such table: importStagingBookmarks) #2930

Description

@BinderManfred

Environment

  • Karakeep 0.31.0
  • Also tested with 0.32.0 (same behaviour)
  • Docker Compose
  • PostgreSQL 16
  • Meilisearch 1.12
  • Debian 12

Docker Compose

services:
  postgres:
    image: postgres:16

  meilisearch:
    image: getmeili/meilisearch:v1.12

  karakeep:
    image: ghcr.io/karakeep-app/karakeep:0.31.0

    environment:
      DATABASE_URL: postgresql://karakeep:karakeeppass@postgres:5432/karakeep
      NEXTAUTH_SECRET: ***
      NEXTAUTH_URL: http://192.168.xxx.xxx:3000
      MEILI_HOST: http://meilisearch:7700
      MEILI_MASTER_KEY: ***

Only /data is mounted as a volume.

Problem

The container starts successfully and database migrations are executed.

However, the import worker continuously logs:

SqliteError: no such table: importStagingBookmarks

The error repeats every few seconds.

Logs

Running db migration script

...

[import] Starting import polling worker

[import] Error in polling loop:
SqliteError: no such table: importStagingBookmarks

Investigation

I inspected all SQLite databases inside the container.

The migration database contains the expected table:

/db_migrations/db.db

Using better-sqlite3:

SELECT name
FROM sqlite_master
WHERE type='table'
AND name='importStagingBookmarks';

returns:

importStagingBookmarks

However:

/app/apps/web/db.db
/app/apps/workers/db.db

do not contain this table.

In fact, both files are automatically created as empty databases:

/app/apps/web/db.db
Size: 0 bytes

/app/apps/workers/db.db
Size: 0 bytes

/db_migrations/db.db
Size: ~577 KB
Contains importStagingBookmarks

Running the same SQL query shows:

/app/apps/web/db.db
[]

/app/apps/workers/db.db
[]

/db_migrations/db.db
[ { name: 'importStagingBookmarks' } ]

Additional information

  • DATABASE_URL is correctly set.
  • PostgreSQL is running normally.
  • Database migrations complete successfully.
  • There are no SQLITE_* environment variables.
  • The problem occurs on both 0.31.0 and 0.32.0.

Expected behaviour

The import worker should use the migrated SQLite database (or create the required schema automatically) instead of opening a newly created empty database.

Actual behaviour

The import worker appears to open an empty SQLite database located at:

/app/apps/workers/db.db

which results in:

SqliteError: no such table: importStagingBookmarks

and the import worker never becomes functional.

Any ideas what could cause the worker to use a different SQLite database than the migration process?

produced with Chat GPD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions