[GH-ISSUE #2564] [BUG]: Error: SQLite database error #1661

Closed
opened 2026-02-22 18:25:56 -05:00 by yindo · 8 comments
Owner

Originally created by @tifDev on GitHub (Nov 1, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2564

How are you running AnythingLLM?

Docker (local)

What happened?

Container crashes while starting

Are there known steps to reproduce?

  1. Launch the container:

export STORAGE_LOCATION=$HOME/anythingllm && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v "${STORAGE_LOCATION}:/app/server/storage" \
-v "${STORAGE_LOCATION}/.env:/app/server/.env" \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

  1. Crashes
  2. Docker logs

[collector] info: Collector hot directory and tmp storage wiped!
[collector] info: Document processor app listening on port 8888
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 417ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)

import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()


See other ways of importing Prisma Client: http://pris.ly/d/importing-client

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db"

26 migrations found in prisma/migrations

Error: SQLite database error
attempt to write a readonly database
   0: sql_schema_connector::sql_migration_persistence::initialize
           with namespaces=None
             at schema-engine/connectors/sql-schema-connector/src/sql_migration_persistence.rs:14
   1: schema_core::state::ApplyMigrations
             at schema-engine/core/src/state.rs:201

Originally created by @tifDev on GitHub (Nov 1, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2564 ### How are you running AnythingLLM? Docker (local) ### What happened? Container crashes while starting ### Are there known steps to reproduce? 1. Launch the container: ``` export STORAGE_LOCATION=$HOME/anythingllm && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v "${STORAGE_LOCATION}:/app/server/storage" \ -v "${STORAGE_LOCATION}/.env:/app/server/.env" \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` 2. Crashes 3. Docker logs ``` [collector] info: Collector hot directory and tmp storage wiped! [collector] info: Document processor app listening on port 8888 Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma ✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 417ms Start using Prisma Client in Node.js (See: https://pris.ly/d/client) import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate) import { PrismaClient } from '@prisma/client/edge' const prisma = new PrismaClient() See other ways of importing Prisma Client: http://pris.ly/d/importing-client Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" 26 migrations found in prisma/migrations Error: SQLite database error attempt to write a readonly database 0: sql_schema_connector::sql_migration_persistence::initialize with namespaces=None at schema-engine/connectors/sql-schema-connector/src/sql_migration_persistence.rs:14 1: schema_core::state::ApplyMigrations at schema-engine/core/src/state.rs:201 ```
yindo added the needs info / can't replicate label 2026-02-22 18:25:56 -05:00
yindo closed this issue 2026-02-22 18:25:56 -05:00
Author
Owner

@shatfield4 commented on GitHub (Nov 1, 2024):

It looks like you are on Linux/macOS.

Do you have multiple containers running AnythingLLM at the same time? This can lock the db and make it read only if 2 containers are trying to access the db at the same time. Another thing that can cause issues like this is if you have the db open in something like DB Browser for SQLite. This can also lock the db and prevent AnythingLLM from writing to it.

@shatfield4 commented on GitHub (Nov 1, 2024): It looks like you are on Linux/macOS. Do you have multiple containers running AnythingLLM at the same time? This can lock the db and make it read only if 2 containers are trying to access the db at the same time. Another thing that can cause issues like this is if you have the db open in something like DB Browser for SQLite. This can also lock the db and prevent AnythingLLM from writing to it.
Author
Owner

@lrbmike commented on GitHub (Dec 18, 2024):

the same issue on ubuntu 24

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db"

Error: Schema engine error:
SQLite database error
unable to open database file: ../storage/anythingllm.db
@lrbmike commented on GitHub (Dec 18, 2024): the same issue on ubuntu 24 ```shell Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" Error: Schema engine error: SQLite database error unable to open database file: ../storage/anythingllm.db ```
Author
Owner

@bogorad commented on GitHub (Dec 21, 2024):

same error. very sloppily made docker-compose

@bogorad commented on GitHub (Dec 21, 2024): same error. very sloppily made docker-compose
Author
Owner

@Reis-A commented on GitHub (Dec 22, 2024):

this is a permission error.
I ran into this when I ran the installation file on ubunut24 as root.
the folder $HOME/anythingllm on the docker host has to have write permission...
now the question for which user ..
for me it was the admin user and not root (even though I run docker as root.)
Maybe this can be clarified. but giving the permission 0777 to the anythingllm folder aswell as to the .env file solves the problem
or once u know the user that needs write permission go for a chgrp and a 0770

@Reis-A commented on GitHub (Dec 22, 2024): this is a permission error. I ran into this when I ran the installation file on ubunut24 as root. the folder $HOME/anythingllm on the docker host has to have write permission... now the question for which user .. for me it was the admin user and not root (even though I run docker as root.) Maybe this can be clarified. but giving the permission 0777 to the anythingllm folder aswell as to the .env file solves the problem or once u know the user that needs write permission go for a chgrp and a 0770
Author
Owner

@lrbmike commented on GitHub (Dec 22, 2024):

this is a permission error. I ran into this when I ran the installation file on ubunut24 as root. the folder $HOME/anythingllm on the docker host has to have write permission... now the question for which user .. for me it was the admin user and not root (even though I run docker as root.) Maybe this can be clarified. but giving the permission 0777 to the anythingllm folder aswell as to the .env file solves the problem or once u know the user that needs write permission go for a chgrp and a 0770

yes, this is a permission error. I solved this problem by giving the directory 777 permissions.

@lrbmike commented on GitHub (Dec 22, 2024): > this is a permission error. I ran into this when I ran the installation file on ubunut24 as root. the folder $HOME/anythingllm on the docker host has to have write permission... now the question for which user .. for me it was the admin user and not root (even though I run docker as root.) Maybe this can be clarified. but giving the permission 0777 to the anythingllm folder aswell as to the .env file solves the problem or once u know the user that needs write permission go for a chgrp and a 0770 yes, this is a permission error. I solved this problem by giving the directory 777 permissions.
Author
Owner

@gitwittidbit commented on GitHub (Oct 7, 2025):

Agree, 777 solves the problem. But I would rather keep the permissions more strict. So does anyone know which user needs to have write permissions on that folder (other than root)?

@gitwittidbit commented on GitHub (Oct 7, 2025): Agree, 777 solves the problem. But I would rather keep the permissions more strict. So does anyone know which user needs to have write permissions on that folder (other than root)?
Author
Owner

@timothycarambat commented on GitHub (Oct 7, 2025):

The same one as the docker user, which if you installed it according to dockers instructions is should be the current user

@timothycarambat commented on GitHub (Oct 7, 2025): The same one as the docker user, which if you installed it according to dockers instructions is should be the current user
yindo changed title from [BUG]: Error: SQLite database error to [GH-ISSUE #2564] [BUG]: Error: SQLite database error 2026-06-05 14:41:59 -04:00
Author
Owner

@nickolasdeluca commented on GitHub (Mar 4, 2026):

I'll leave this here in case anyone runs into issues with permission for the SQLite database.

In my scenario, I'm running the container on an Oracle Cloud Instance, so, since Docker containers often run as the first non root user, which is opc in this scenario, you have to chown the created dir to opc or 1000.

sudo chown -R 1000:1000 anythingllm

or

sudo chown -R opc:opc anythingllm

That did the trick for me.

<!-- gh-comment-id:3999957670 --> @nickolasdeluca commented on GitHub (Mar 4, 2026): I'll leave this here in case anyone runs into issues with permission for the SQLite database. In my scenario, I'm running the container on an Oracle Cloud Instance, so, since Docker containers often run as the first non root user, which is opc in this scenario, you have to chown the created dir to opc or 1000. ```bash sudo chown -R 1000:1000 anythingllm ``` or ```bash sudo chown -R opc:opc anythingllm ``` That did the trick for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1661