Suddenly can't open some workflows, they return 404

Describe the problem/error/question

Suddenly some workflows stopped working, and I can not open them, saying they could not be found. Network tab shows 404 trying to get it /rest/workflows/XXXMhEXXXq9XXX, but I checked in the database, and all of them still exist.

What is the error message (if any)?

Could not find workflow
Could not load the workflow - you can only access workflows owned by you

Please share your workflow

If relevant, I can see this error in the console

2025-07-23T14:49:26.005600574Z There was a problem in ‘Gmail Trigger’ node in workflow ‘XXXXX’: ‘undefined’
2025-07-23T14:49:46.189595382Z Error while saving insights metadata and raw data

That workflow contains a simple Gmail Receive Email Trigger that used to long for a long time, and hasn’t been touched for months. Today it suddenly broke, and I assume other workflows that are not working are the ones importing it.

Any idea how to fix it? Because I can’t open the workflow to see it.
Shouldn’t n8n grafcefully handle this case? Instead of breaking the entire workflow and showing a wrong error about ownership?

Information on your n8n setup

  • n8n version: 1.98.1 CE
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): via Coolify/Docker Image
  • Operating system: Ubuntu 24

Ok, found more info while debugging the issue. I tried to create a new workflow with Gmail trigger, but my Gmail credentials were gone.

Looking into credentials, I do see it there:

It appears being updated 1 day ago (even though I did not), but there is another user that has n8n member access to this dashboard (even though, they don’t have access to any of the existing credentials, so they should’t be able to modify them in any way).

If I try to click to open the credential, I get an error:

Problem loading credential
Credential with ID “XXXFilk3kepQb” could not be found.*

Security issue?

How could a member take over the credentials of a project from the owner?
Where in the DB are the credentials ↔ user relationships? I see in shared_credentials it is still assigned to the owner/same projectid:

credentialsId projectId role createdAt updatedAt 
XXXX9Filk3kepQb	XXXPFDKvE51TDu	credential:owner	2025-05-02T14:40:00.096Z	2025-05-02T14:40:00.096Z

Ok, so the issue is that if I do

SELECT id FROM credentials_entity WHERE id ='XXXXm9Filk3kepQb'; - This doesn’t return anything
SELECT id FROM credentials_entity WHERE id LIKE '%XXXXm9Filk3kepQb%'; - This works

BUT, those values are identical, there are no extra white-space characters, and the hex encoding of those strings is the same.

This looks to be some Postgres error (?) If it matters, I also switched to pgvector (to be able to have vector store).

I have found the issue!

This is one of the most weird bugs I encountered.

Root cause:

  • After updating to pgvector it looks like the index for the gmail id in credentials_entity got corrupted.
  • This meant that the credentials could be listed, most of them worked, but the Gmail credential could not be directly found by ID.

Solution:

REINDEX TABLE credentials_entity;

Reindexing the table fixed the ID searching, which fixed the Gmail Trigger, which fixed all workflows that included them.

Just to be safe, I reindexed the entire DB after: REINDEX DATABASE n8n

1 Like