n8n crashing again and again

yourstim
HOBBY

15 days ago

looks like there's a problem with versions mismatch , working with n8n with template n8n/worker for almost a year, and suddenly after update in the mid of august my services crashing, and for the last week i dont have at all possibility to use n8n and all my automations........ oh
so!!!! ive seen some posts about it, and feels like theres a bigger problem, and here's my logs:

2025-09-08 09:33:32.345 UTC [1364] WARNING: database "railway" has a collation version mismatch

2025-09-08 09:33:32.345 UTC [1364] DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41.

2025-09-08 09:33:32.345 UTC [1364] HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE railway REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

the problem is that i run n8n with railway's ui without any terminal, so i cant run ALTER DATABASE railway REFRESH COLLATION VERSION, and i also deployed a new instance with the same template - and it also crashes!!

someone else struggling to save its n8n in last 2 weeks? appreciate any help, thanks

$10 Bounty

7 Replies

Railway
BOT

15 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


kartikai1
PRO

15 days ago

Same thing is happening to me


ronnel-matthew-robles
HOBBY

14 days ago

I solved that problem by installing railway CLI then running the command as stated there.

1. Install Railway CLI: https://docs.railway.com/guides/cli
2. Login using your terminal: npx railway login
3. Connect to your postgres: railway connect Postgres
4. You should see something like this in your terminal:
WARNING: database "railway" has a collation version mismatch DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41. HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE railway REFRESH COLLATION VERSION, or build PostgreSQL with the right library version. psql (14.19 (Homebrew), server 16.10 (Debian 16.10-1.pgdg13+1)) WARNING: psql major version 14, server major version 16. Some psql features might not work. SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. railway=#

5. Run this: ALTER DATABASE railway REFRESH COLLATION VERSION;

Then you are supposed to see this in your terminal:
NOTICE: changing version from 2.36 to 2.41 ALTER DATABASE
railway=#

That should fix your version mismatch.


ronnel-matthew-robles

I solved that problem by installing railway CLI then running the command as stated there.1. Install Railway CLI: https://docs.railway.com/guides/cli2. Login using your terminal: npx railway login3. Connect to your postgres: railway connect Postgres4. You should see something like this in your terminal:WARNING: database "railway" has a collation version mismatch DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41. HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE railway REFRESH COLLATION VERSION, or build PostgreSQL with the right library version. psql (14.19 (Homebrew), server 16.10 (Debian 16.10-1.pgdg13+1)) WARNING: psql major version 14, server major version 16. Some psql features might not work. SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. railway=#5. Run this: ALTER DATABASE railway REFRESH COLLATION VERSION;Then you are supposed to see this in your terminal:NOTICE: changing version from 2.36 to 2.41 ALTER DATABASE railway=#That should fix your version mismatch.

yourstim
HOBBY

14 days ago

thanks! made a similar process but in terminal, thanks for your response!


yourstim
HOBBY

14 days ago

# How We Recovered a Broken n8n Instance (401 Unauthorized, user.role errors, workflows not loading)

I hit a nasty situation after updating my n8n deployment on Railway:

- Couldn’t log in (**401 Unauthorized**).

- Console showed errors like:

- column User.role does not exist

- Unauthorized when hitting /rest/login.

- After bypassing login, workflows list loaded but opening a workflow spun forever.

Here’s how I fixed it step by step:

---

## 1. Database Migration Check

Connected to Postgres railway psql) and ran:

```sql

SELECT id, name, timestamp FROM migrations ORDER BY id DESC LIMIT 10;

Confirmed migrations up to ReplaceDataStoreTablesWithDataTables… had run.

So the issue wasn’t missing migrations — the data and schema were fine.


yourstim
HOBBY

14 days ago

##2. Reset Auth Tables

Old auth entries were conflicting with new auth logic.
I truncated the related tables:

TRUNCATE TABLE auth_identity CASCADE;
TRUNCATE TABLE user_api_keys CASCADE;
TRUNCATE TABLE invalid_auth_token CASCADE;

This removed broken identity links.


yourstim
HOBBY

14 days ago

##3. Recreate Auth Identity

Checked my existing user:

SELECT id, email, "firstName", "lastName" FROM "user";

Then recreated the auth_identity entry:

INSERT INTO auth_identity ("userId", "providerId", "providerType")
VALUES (
  '<your-user-id>',
  '<your-email>',
  'email'
);

##4. Reset Admin Password

Generated a new bcrypt hash locally:

mkdir ~/bcrypt-test && cd ~/bcrypt-test
npm init -y
npm install bcryptjs
node -e "console.log(require('bcryptjs').hashSync('YOURPASSWORD', 10))"

Then updated Postgres:

UPDATE "user"
SET password = '<the-bcrypt-hash>'
WHERE email = '<your-email>';

Now I could log into the UI again .

##5. Fix Workflow Loading (the final blocker)

Workflows still wouldn’t open. Turned out the primary and worker were running different versions:

  • Primary: 1.110.1

  • Worker: 1.109.2

This version mismatch caused endless loading because the worker and primary couldn’t agree on schema and API responses.

Fix:

  • Pinned both primary and worker to the same Docker image (version ive choosen is the last stable version for n8n in september 2025):

    n8nio/n8n:1.110.1
  • Redeployed both (worker first, then primary).

After this, workflows opened normally and everything was back.

Lessons Learned

  • Always keep primary and worker on the same version.

  • If login breaks with user.role errors, clear auth_identity and reset the password hash manually.

  • If workflows won’t open after login → check for version mismatch between services.

Now I have my n8n fully back with all my data. Hopefully this helps anyone else stuck with the same 401 Unauthorized / user.role does not exist nightmare!