Community plugin doesn't stay installed after restart

Describe the problem/error/question

Every time I restart n8n container, the [ @jordanburke/n8n-nodes-discord ]becomes unrecognized (I also tried other community nodes, same error).

The error is:
The following error occurred on workflow activation:
Unrecognized node type: @jordanburke/n8n-nodes-discord".

n8n version: Version 1.60.1
Database: Postgresql
Running n8n via Docker on Unraid
OS: Unraid Server

What is the error message (if any)?

2024-09-27T23:18:12.483Z | debug | Loaded all credentials and nodes from @jordanburke/n8n-nodes-discord

“{\n credentials: 1,\n nodes: 2,\n file: ‘LoggerProxy.js’,\n function: ‘exports.debug’\n}”

2024-09-27T23:18:12.511Z | error | Failed to save installed packages and nodes "{\n error: QueryFailedError: duplicate key value violates unique constraint "PK_8ebd28194e4f792f96b5933423fc439df97d9689"\n at PostgresQueryRunner.query

[…]

at EntityManager.transaction (/usr/local/lib/node_modules/n8n/node_modules/@n8n/typeorm/entity-manager/EntityManager.js:73:28)\n at InstalledPackagesRepository.saveInstalledPackageWithNodes (/usr/local/lib/node_modules/n8n/dist/databases/repositories/installed-packages.repository.js:26:9)\n at CommunityPackagesService.persistInstalledPackage (/usr/local/lib/node_modules/n8n/dist/services/community-packages.service.js:69:20) {\n query: ‘INSERT INTO "public"."installed_nodes"("name", "type", "latestVersion", "package") VALUES ($1, $2, $3, $4)’,\n parameters: [\n ‘Discord Send’,\n ‘@jordanburke/n8n-nodes-discord.@jordanburke/n8n-nodes-discord.discord’,\n 1,\n ‘@jordanburke/n8n-nodes-discord’\n ],\n driverError: error: duplicate key value violates unique constraint "PK_8ebd28194e4f792f96b5933423fc439df97d9689"\n at /usr/local/lib/node_modules/n8n/node_modules/pg/lib/client.js:526:17\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at PostgresQueryRunner.query

[…]

InstalledPackagesRepository.saveInstalledPackageWithNodes (/usr/local/lib/node_modules/n8n/dist/databases/repositories/installed-packages.repository.js:26:9) {\n length: 269,\n severity: ‘ERROR’,\n code: ‘23505’,\n detail: ‘Key (name)=(Discord Send) already exists.’,\n hint: undefined,\n position: undefined,\n internalPosition: undefined,\n internalQuery: undefined,\n where: undefined,\n schema: ‘public’,\n table: ‘installed_nodes’,\n column: undefined,\n dataType: undefined,\n constraint: ‘PK_8ebd28194e4f792f96b5933423fc439df97d9689’,\n file: ‘nbtinsert.c’,\n line: ‘666’,\n routine: ‘_bt_check_unique’\n },\n length: 269,\n severity: ‘ERROR’,\n code: ‘23505’,\n detail: ‘Key (name)=(Discord Send) already exists.’,\n hint: undefined,\n position: undefined,\n internalPosition: undefined,\n internalQuery: undefined,\n where: undefined,\n schema: ‘public’,\n table: ‘installed_nodes’,\n column: undefined,\n dataType: undefined,\n constraint: ‘PK_8ebd28194e4f792f96b5933423fc439df97d9689’,\n file: ‘nbtinsert.c’,\n line: ‘666’,\n routine: ‘_bt_check_unique’\n },\n packageName: ‘@jordanburke/n8n-nodes-discord’,\n file: ‘community-packages.service.js’,\n function: ‘persistInstalledPackage’\n}"
2024-09-27T23:18:12.513Z | error |

n8n was unable to install the missing packages. “{\n file: ‘community-packages.service.js’,\n function: ‘checkForMissingPackages’\n}”

Please share your workflow

Literraly any workflow with one node from the community plugin fails after a single restart.

I noticed The issue is the same as :

But his fix doesn’t seem to work on my instance.

I Use the Env var to reinstall automatically the missing packages but still the error keep occuring.

n8n version: Version 1.60.1
Database: Postgresql
n8n EXECUTIONS_PROCESS setting (default: own, main):own
Running n8n via Docker on Unraid
OS: Unraid Server

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

n8n version: Version 1.60.1
Database: Postgresql
n8n EXECUTIONS_PROCESS setting (default: own, main):own
Running n8n via Docker on Unraid
OS: Unraid Server

Hey @Radium,

I have community packages on my own instance of n8n and I don’t have this problem.

Can you share the details on how you have n8n set up, which env options you have set and what storage mounts / binds you have in place.

Hey @Jon

I found out where the problem was :

I had the N8N_REINSTALL_MISSING_PACKAGES: = true

but the n8n folder was persistant and accessible.

It seems like in this case the database get messed up in the node table as decribed in the post below : Community node become unrecognized every time I restart n8n container

And this after every restarts.

The solution was :

→ Uninstall the module
→ Clean the n8n module folder (remove the folder of the community module)
→ Clean the database rows if any (there shouldn’t be after uninstall)

→ Ensure n8n folder is persisted and accessible to the container
→ Set N8N_REINSTALL_MISSING_PACKAGES to False
→ Reinstall the module from n8n settings.

TL;DR; It seems like N8N_REINSTALL_MISSING_PACKAGES + persistant folder on the same time cause the issue.

1 Like

@Jon Maybe you should consider checking the at n8n startup if there is a conflictual setup with persistant folder + the flag or at least document that could cause problems if turned on unnecessarly ?

Hey @Radium

I have never seen it cause this issue before but I will check it and get a dev ticket created to resolve it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.