Error: Problem running workflow (invalid ELF header)

Describe the problem/error/question

Hello everyone! Today I encountered a problem when starting the AI Agent node.
It doesn’t start, and an error is returned: Problem running workflow
/usr/lib/node_modules/n8n/node_modules/sqlite3/build/Release/node_sqlite3.node: invalid ELF header

What could be the reason?

Information on your n8n setup

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

Does it only happen with the AI Agent node or do you get an issue with all workflows?

I would recommend moving to a Docker based install which will have less issues but can you share the version of nodejs you are using? I think the issue is likely to be that the version of sqlite3 is not compatible with your CPU or OS like maybe you are using 32-bit ARM or something maybe an old Pi.

This problem occurs only with the AI Agent node. Everything else works like clockwork.
NodeJS version 20.15.0

I have a habit of not keeping projects in Docker containers in production.

Hey @mesaich,

That is very odd, I have not seen any other reports of this. Just to rule out anything odd, What sort of CPU are you using and has your sqlite file always been on the Linux filesystem?

The lscpu command shows:

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Model name: AMD Ryzen 9 7950X3D 16-Core Processor

I made changes to the sqlite file once using HeidiSQL.

I would have thought that would be ok, I would be tempted to uninstall n8n and clear out the modules folder then try and install it again to see if that helps.

There are too many running processes, so I can’t stop them right now. I’ll make these adjustments during the next update.

1 Like

I deleted the old n8n instance for updating and installed a new one. But the error still remains.

are you installing n8n directly on the machine that it is running on, or are you copying over the installation from another machine somehow?

This error comes from when the sqlite3 bindings in /usr/lib/node_modules/n8n/node_modules/sqlite3 do not match the correct CPU architecture, which is likely to happen if either the folder is copied from another machine, or if some other process on the machine is messing up the compiled bindings.
If it’s the first option, then the solution is to always install directly on the machine using npm -g install n8n.
If it’s the second thing, then using a docker container would be better.

Apparently, this is because I opened the sqlite3 file on my computer and then uploaded it back (replacing the original). Is there a way to reconcile the sqlite3 file with the virtual server now, or do I need to reinstall n8n?

I migrated everything to PostgreSQL. But the error still remains. Shouldn’t it disappear automatically?

Hey @mesaich,

Assuming you are using Postgres yeah you shouldn’t see any sqlite errors but if the local files have been changed it may need a reinstall still.

Have you done a test in a docker container to see if this is local or not?

I haven’t tested it in Docker yet. But another instance on a different server, which is also set up through n8n, gives the same error.

You could try going to /usr/lib/node_modules/n8n and then run npm rebuild sqlite3. That might be fix the issue.

2 Likes

Yes, it helped! Thank you very much!

1 Like

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