Hi, I’ve seen several posts mention the same workflow with the same error, however none of the threads i’ve read end with a solution, and they are all closed for posting, hence this ‘repeat’ post.
Describe the problem/error/question
I’ve been running this workflow for some time without issue, however recently noticed that it’s been erroring out for a few weeks to a month now.
What is the error message (if any)?
Problem in node ‘isDiffOrNew‘
Unexpected end of JSON input [Line 4]
Please share your workflow
Share the output returned by the last node
The error occurs on run 9 of 9, with the prior 8 having no issues. the entire logged message is as follows:
{
"__type":
"$$EventMessageWorkflow",
"id":"334e7c51-e657-47ea-923ad22105d88712",
"ts":"2024-04-22T22:26:29.770-04:00",
"eventName":"n8n.workflow.failed",
"message":"n8n.workflow.failed",
"payload":
{
"executionId":"334545",
"success":false,
"userId":"8e18c06a-afa3-44f5-b611-e2bfe762f0dd",
"workflowId":"9",
"isManual":true,
"workflowName":"Back Up Your n8n Workflows To Github",
"lastNodeExecuted":"isDiffOrNew",
"errorNodeType":"n8n-nodes-base.function",
"errorNodeId":"8",
"errorMessage":"Unexpected end of JSON input [Line 4]"
}
}
The specific workflow it appears to be having an issue with is "workflowId":"9" which just so happens to be the very workflow that is giving errors. As this has been working for 1+ years now, I’m not sure what is suddenly wrong with this workflow. I’ve tried duplicating it and testing the duplicate, and have run into the same issue with copied workflow.
Information on your n8n setup
n8n version:Version 1.37.3
Database (default: SQLite):SQLite
n8n EXECUTIONS_PROCESS setting (default: own, main): default setting (no custom setting for this value).
Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
I think I might need to revisit the worklfow as there is probably a better way to handle it now. The error itself looks like there is something funky in the worklfow json but I am not sure what that would be.
For what it’s worth, i downloaded the returned json from the step (it was 1.2MB and n8n wanted nothing to do with displaying it in the output window) and tossed the raw contents at a json validator which found no errors.
i ended up exec-ing into the container, and removing all of the files the workflow created.
i then duplicated the workflow that the loop crashed on and removed the original workflow. test workflow then succeeded.
none of that gets closer to truly understanding the issue, but a good workaround is just fine with me in this case!
As an update, I’ve just revisited this issue and after staring at a jumble of base64 encoded gibberish that is handed to the step and viewing the output of JSON.parse(), I noticed some truncated workflow names, which I assume led to the reported Unexpected end of JSON input error.
On a whim, I renamed 2 similarly named workflows that both contained (characters enclosed in parenthesis), removing the parenthesis from each workflow’s title.
Subsequently, testing the workflow resulted in a successful execution, and as the workflows were changed by the renaming, the github repository was updated as would be expected.
This error cropped up at about the time I’d posted this initial message.
Prior to that for about a year the (parenthesis) caused no issues, so I’d not considered the workflow names themselves to be suspect.
However, in retrospect, the error initially pointed to line 4: JSON.parse(Buffer.from(items[0].json.content, 'base64'));
Something in the parser must have changed right around the time my errors started occurring.
I just wanted to close the open loop here by providing what turned out to be the solution to my question.