Unable to save workflows


I have new linux dev server on which installed n8n. When i try to save workflow, its giving error, sqlite read only.

Did you check if that is the case? Is the SQLite file read-only?
(The file can be found in your user-folder under: .n8n/database.sqlite)

That worked after giving write permissions. I didn’t have that problem when I installed on my other VM…

If it is totally new n8n instance then n8n creates the files, so that kind of problem should be impossible to occur. One reason could be if the database file (or the whole folder) did get copied over from another server. Because then the access rights could differ.

When I was installing n8n, I had sqlite3 error, so installed sqlite again. It could be that.

Again, I started getting this error. database.sqlite under my profile has full permissions now.

{ QueryFailedError: SQLITE_READONLY: attempt to write a readonly database
at new QueryFailedError (/usr/local/lib/node_modules/n8n/node_modules/typeorm/error/QueryFailedError.js:11:28)
at Statement.handler (/usr/local/lib/node_modules/n8n/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js:48:38)
message: ‘SQLITE_READONLY: attempt to write a readonly database’,
errno: 8,
name: ‘QueryFailedError’,
‘INSERT INTO “workflow_entity”(“id”, “name”, “active”, “nodes”, “connections”, “createdAt”, “updatedAt”, “settings”, “staticData”) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, NULL)’,

No idea what is going on here. Never heard of any other n8n user having this problem. So it must probably be something specific to your server-setup. Like for example some other process (with a different user) writing to it or changing permissions. Have sadly no other idea right now what exactly could be going on but does really not sound like something n8n would do by itself.

After changing owner of database, it solved

How did you change the owner? And who should own the db?

The owner should be the same user you run n8n with. If you run n8n with Linux, then you would have to use the chown command to do that.

If see assume your Linux user is called n8n and the group automation then the command would be:

chown -R n8n:automation WHEREEVER_YOUR_N8N_FOLDER_IS_LOCATED/.n8n

@jan Thank you Jan