Error: spawn E2BIG

I’m using the response of http request of a web page that returns a thread dump of java process (that could be a lot of output text)
After this node I put a “Execute command” doing echo “” | head -n -1 and this gives me this error:

Error: spawn E2BIG
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at spawn (child_process.js:553:9)
    at Object.execFile (child_process.js:237:17)
    at Object.exec (child_process.js:158:25)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ExecuteCommand/ExecuteCommand.node.js:14:25
    at new Promise (<anonymous>)
    at execPromise (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ExecuteCommand/ExecuteCommand.node.js:13:12)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ExecuteCommand/ExecuteCommand.node.js:72:68)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:524:37)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:62

Could you help me, please?

Hey @jordir,

It has been a long time since I have seen an e2big error message, Are you passing the entire output of the web request to the echo? You normally see e2big when the command length is too big so it could be that you hit the ARG_MAX limit if you run getconf ARG_MAX in your execute command it will tell you how many bytes you can have in a command per argument.

Best bet would be to take the response, save it to the local file and then use cat with the head command or depending on what is splitting the lines in the output you might be able to just use a function node / expression.

1 Like

Thanks @Jon.
Is this I’m passing the entire output. I tried your solution and it works ;).

1 Like

Perfect :+1:

So what is your long term goal with the thread dump? Will you be using n8n to automate part of an analysis process?

Hi Jon,
The idea is use n8n for analysis.
We have an endpoint of get all the thread dump and in the first line we have a summary.
My idea is get this line and if this line pass some limit then send an email (at least for the first version).

1 Like