[GH-ISSUE #426] SQLite database error #243

Closed
opened 2026-02-22 18:18:31 -05:00 by yindo · 13 comments
Owner

Originally created by @RappyTV on GitHub (Dec 12, 2023).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/426

When I try to start the docker-compose container after building I get this error log:

anything-llm  | [2023-12-12 10:19:31 +0000] [10] [INFO] Starting gunicorn 20.1.0
anything-llm  | [2023-12-12 10:19:31 +0000] [10] [INFO] Listening at: http://0.0.0.0:8888 (10)
anything-llm  | [2023-12-12 10:19:31 +0000] [10] [INFO] Using worker: sync
anything-llm  | [2023-12-12 10:19:31 +0000] [17] [INFO] Booting worker with pid: 17
anything-llm  | [2023-12-12 10:19:31 +0000] [18] [INFO] Booting worker with pid: 18
anything-llm  | [2023-12-12 10:19:31 +0000] [19] [INFO] Booting worker with pid: 19
anything-llm  | [2023-12-12 10:19:31 +0000] [24] [INFO] Booting worker with pid: 24
anything-llm  | Environment variables loaded from .env
anything-llm  | Prisma schema loaded from prisma/schema.prisma
anything-llm  |
anything-llm  | ✔ Generated Prisma Client (v5.3.0) to ./node_modules/@prisma/client in 701ms
anything-llm  |
anything-llm  | Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
anything-llm  | ```
anything-llm  | import { PrismaClient } from '@prisma/client'
anything-llm  | const prisma = new PrismaClient()
anything-llm  | ```
anything-llm  | or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
anything-llm  | ```
anything-llm  | import { PrismaClient } from '@prisma/client/edge'
anything-llm  | const prisma = new PrismaClient()
anything-llm  | ```
anything-llm  |
anything-llm  | See other ways of importing Prisma Client: http://pris.ly/d/importing-client
anything-llm  |
anything-llm  |
anything-llm  | warn Versions of prisma@5.3.1 and @prisma/client@5.3.0 don't match.
anything-llm  | This might lead to unexpected behavior.
anything-llm  | Please make sure they have the same version.
anything-llm  | Environment variables loaded from .env
anything-llm  | Prisma schema loaded from prisma/schema.prisma
anything-llm  | Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db"
anything-llm  |
anything-llm  | 4 migrations found in prisma/migrations
anything-llm  |
anything-llm  | Error: SQLite database error
anything-llm  | attempt to write a readonly database
anything-llm  |    0: sql_schema_connector::sql_migration_persistence::initialize
anything-llm  |            with namespaces=None
anything-llm  |              at schema-engine/connectors/sql-schema-connector/src/sql_migration_persistence.rs:14
anything-llm  |    1: schema_core::state::ApplyMigrations
anything-llm  |              at schema-engine/core/src/state.rs:201
Originally created by @RappyTV on GitHub (Dec 12, 2023). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/426 When I try to start the docker-compose container after building I get this error log: ``` anything-llm | [2023-12-12 10:19:31 +0000] [10] [INFO] Starting gunicorn 20.1.0 anything-llm | [2023-12-12 10:19:31 +0000] [10] [INFO] Listening at: http://0.0.0.0:8888 (10) anything-llm | [2023-12-12 10:19:31 +0000] [10] [INFO] Using worker: sync anything-llm | [2023-12-12 10:19:31 +0000] [17] [INFO] Booting worker with pid: 17 anything-llm | [2023-12-12 10:19:31 +0000] [18] [INFO] Booting worker with pid: 18 anything-llm | [2023-12-12 10:19:31 +0000] [19] [INFO] Booting worker with pid: 19 anything-llm | [2023-12-12 10:19:31 +0000] [24] [INFO] Booting worker with pid: 24 anything-llm | Environment variables loaded from .env anything-llm | Prisma schema loaded from prisma/schema.prisma anything-llm | anything-llm | ✔ Generated Prisma Client (v5.3.0) to ./node_modules/@prisma/client in 701ms anything-llm | anything-llm | Start using Prisma Client in Node.js (See: https://pris.ly/d/client) anything-llm | ``` anything-llm | import { PrismaClient } from '@prisma/client' anything-llm | const prisma = new PrismaClient() anything-llm | ``` anything-llm | or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate) anything-llm | ``` anything-llm | import { PrismaClient } from '@prisma/client/edge' anything-llm | const prisma = new PrismaClient() anything-llm | ``` anything-llm | anything-llm | See other ways of importing Prisma Client: http://pris.ly/d/importing-client anything-llm | anything-llm | anything-llm | warn Versions of prisma@5.3.1 and @prisma/client@5.3.0 don't match. anything-llm | This might lead to unexpected behavior. anything-llm | Please make sure they have the same version. anything-llm | Environment variables loaded from .env anything-llm | Prisma schema loaded from prisma/schema.prisma anything-llm | Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" anything-llm | anything-llm | 4 migrations found in prisma/migrations anything-llm | anything-llm | Error: SQLite database error anything-llm | attempt to write a readonly database anything-llm | 0: sql_schema_connector::sql_migration_persistence::initialize anything-llm | with namespaces=None anything-llm | at schema-engine/connectors/sql-schema-connector/src/sql_migration_persistence.rs:14 anything-llm | 1: schema_core::state::ApplyMigrations anything-llm | at schema-engine/core/src/state.rs:201 ```
yindo closed this issue 2026-02-22 18:18:31 -05:00
Author
Owner

@superobk commented on GitHub (Dec 12, 2023):

Seems the anythingllm.db file is an empty one and cannot be accessed normally, may I know how to fix it. Thanks!

@superobk commented on GitHub (Dec 12, 2023): Seems the anythingllm.db file is an empty one and cannot be accessed normally, may I know how to fix it. Thanks!
Author
Owner

@adukale commented on GitHub (Dec 12, 2023):

Faced this issue just now, resolved by setting the permission of directory containing "anythingllm.db" to current user.

@adukale commented on GitHub (Dec 12, 2023): Faced this issue just now, resolved by setting the permission of directory containing "anythingllm.db" to current user.
Author
Owner

@RappyTV commented on GitHub (Dec 12, 2023):

didn't work for me

@RappyTV commented on GitHub (Dec 12, 2023): didn't work for me
Author
Owner

@RappyTV commented on GitHub (Dec 12, 2023):

okay apparently the problem was, that I tried to start it as root

@RappyTV commented on GitHub (Dec 12, 2023): okay apparently the problem was, that I tried to start it as root
Author
Owner

@jingzhao-self commented on GitHub (Dec 18, 2023):

just for test:
chmod -R 777 /var/lib/anythingllm

@jingzhao-self commented on GitHub (Dec 18, 2023): just for test: chmod -R 777 /var/lib/anythingllm
Author
Owner

@srccd-dev commented on GitHub (May 18, 2024):

okay apparently the problem was, that I tried to start it as root

This was my error, running michael@localhost:~$ sudo docker run mintplexlabs/anythingllm:latest fixed it

@srccd-dev commented on GitHub (May 18, 2024): > okay apparently the problem was, that I tried to start it as root This was my error, running michael@localhost:~$ sudo docker run mintplexlabs/anythingllm:latest fixed it
Author
Owner

@pancodia commented on GitHub (Oct 9, 2024):

any risk running the container as root. Without root, I had error saying "unable to open database file ../storage/anythingllm.db"

@pancodia commented on GitHub (Oct 9, 2024): any risk running the container as root. Without root, I had error saying "unable to open database file ../storage/anythingllm.db"
Author
Owner

@timothycarambat commented on GitHub (Oct 9, 2024):

In general, you shouldnt run docker as root and should have a user who can run docker ... however if this is your personal machine it's your discretion.

@timothycarambat commented on GitHub (Oct 9, 2024): In general, you _shouldnt_ run docker as root and should have a user who can run `docker ...` however if this is your personal machine it's your discretion.
Author
Owner

@draculd commented on GitHub (Oct 15, 2024):

just for test: chmod -R 777 /var/lib/anythingllm

this works for me, thx.

@draculd commented on GitHub (Oct 15, 2024): > just for test: chmod -R 777 /var/lib/anythingllm this works for me, thx.
Author
Owner

@davieskan commented on GitHub (Jan 22, 2025):

I was using ubuntu and "sudo su -" to run docker commands. But use your primary user environment, don't run "sudo su -" as root, this will use the wrong "environment" vars such as $HOME will become "root", instead of your "user" environment (for me it was "$USER" = user). Once i've exited back to my "user" environment and ran "sudo docker" instead, everything worked like a charm.

Hope this make sense and works for you.

@davieskan commented on GitHub (Jan 22, 2025): I was using ubuntu and "sudo su -" to run docker commands. But use your primary user environment, don't run "sudo su -" as root, this will use the wrong "environment" vars such as $HOME will become "root", instead of your "user" environment (for me it was "$USER" = user). Once i've exited back to my "user" environment and ran "sudo docker" instead, everything worked like a charm. Hope this make sense and works for you.
Author
Owner

@Azzellz commented on GitHub (Feb 15, 2025):

chmod -R 777 /var/lib/anythingllm

Great.

@Azzellz commented on GitHub (Feb 15, 2025): > chmod -R 777 /var/lib/anythingllm Great.
Author
Owner

@Churrppy commented on GitHub (Jun 7, 2025):

For anyone else experiencing issues. The problem is permissions. Make sure to do the following:

  1. DO NOT run docker as root. Best practice is to create a dedicated Linux account to run Docker containers.
  2. Make sure to configure the UID and GID properly in the environment section or in a dedicated .env file. The UID and GID need to match that of the Linux account you are running Docker with. See:
    https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#about-uid-and-gid-in-the-env
@Churrppy commented on GitHub (Jun 7, 2025): For anyone else experiencing issues. The problem is permissions. Make sure to do the following: 1. **DO NOT** run docker as root. Best practice is to create a dedicated Linux account to run Docker containers. 2. Make sure to configure the UID and GID properly in the environment section or in a dedicated .env file. The UID and GID need to match that of the Linux account you are running Docker with. See: https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#about-uid-and-gid-in-the-env
Author
Owner

@Naggafin commented on GitHub (Jun 7, 2025):

For anyone else experiencing issues. The problem is permissions. Make sure to do the following:

  1. DO NOT run docker as root. Best practice is to create a dedicated Linux account to run Docker containers.
  2. Make sure to configure the UID and GID properly in the environment section or in a dedicated .env file. The UID and GID need to match that of the Linux account you are running Docker with. See:
    https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#about-uid-and-gid-in-the-env

I specified these in my .env file, and they appear to be ignored given this problem persists for me. That, or I'm incorrectly specifying them. It's difficult to tell right now as the documentation only mentions the default behavior and that one may need to specify UID and GID, but without clear instructions on how to do that. .env file below:

UID=33
GID=33

My deployment directory is /srv/anythingllm, which is indeed owned by www-data:www-data (33:33). The folder permission is 750, while the only file inside, .env, is 640.

@Naggafin commented on GitHub (Jun 7, 2025): > For anyone else experiencing issues. The problem is permissions. Make sure to do the following: > > 1. **DO NOT** run docker as root. Best practice is to create a dedicated Linux account to run Docker containers. > 2. Make sure to configure the UID and GID properly in the environment section or in a dedicated .env file. The UID and GID need to match that of the Linux account you are running Docker with. See: > https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#about-uid-and-gid-in-the-env I specified these in my .env file, and they appear to be ignored given this problem persists for me. That, or I'm incorrectly specifying them. It's difficult to tell right now as the documentation only mentions the default behavior and that one may need to specify UID and GID, but without clear instructions on how to do that. .env file below: ``` UID=33 GID=33 ``` My deployment directory is `/srv/anythingllm`, which is indeed owned by `www-data:www-data` (`33:33`). The folder permission is `750`, while the only file inside, .env, is `640`.
yindo changed title from SQLite database error to [GH-ISSUE #426] SQLite database error 2026-06-05 14:34:14 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#243