n8n workflow stalling and producing corrupted data

I’m having trouble with my n8n setup in Docker. My workflow used to work fine but now it’s stuck. It has a Webhook node and a write-to-binary node. The workflow is supposed to save image files from a web form to the server.

When I try to run it now, it just hangs forever. The API call gets a 500 error. In the n8n UI, the execution stays in “running” mode. The file does get created, but it’s corrupted.

The logs show an error when moving the file from the temp folder to the final location. I’ve tried everything I can think of to fix it.

Here’s a simplified version of my workflow:

{
  "nodes": [
    {
      "name": "StartNode",
      "type": "n8n-nodes-base.start"
    },
    {
      "name": "SaveFile",
      "type": "n8n-nodes-base.writeBinaryFile",
      "parameters": {
        "fileName": "=/uploads/{{ $json.query.filename }}.jpg"
      }
    },
    {
      "name": "InputHook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "file-upload",
        "httpMethod": "PUT"
      }
    }
  ]
}

Any ideas on how to fix this or what might be causing it?

I’ve dealt with similar issues in n8n before. One thing that often helps is increasing the timeout settings for your nodes. Sometimes, file operations take longer than expected, especially with larger files or slower network connections.

Check your Docker container’s resource allocation too. If it’s not getting enough CPU or memory, it could cause slowdowns and timeouts. You might need to adjust your Docker settings.

Another possibility is network-related issues. If you’re fetching the image from an external source, temporary network hiccups could interrupt the download. Adding retry logic to your workflow could help mitigate this.

Lastly, consider implementing logging or debugging nodes throughout your workflow. This can help pinpoint exactly where things are going wrong. It’s tedious, but it’s saved me countless hours of troubleshooting in the past.

hey, have u checked ur docker container logs? sometimes theres hidden errors there. also, make sure ur not running outta disk space - that can cause weird issues. maybe try updating n8n to the latest version too, could be a bug thats been fixed. good luck!

I’ve encountered similar issues with n8n workflows stalling and producing corrupted data, especially when dealing with file operations. From my experience, this could be related to file permissions or disk space problems in your Docker environment.

One thing that helped me was to double-check the file permissions for the directory where n8n is trying to save the files. Make sure the n8n process has write access to both the temporary and final locations.

Another potential cause could be running out of disk space. When the disk is full, file operations can fail silently, leading to corrupted files and hanging processes. I’d recommend checking your Docker host’s available disk space and cleaning up if necessary.

If those don’t solve it, you might want to try breaking down your workflow into smaller steps and adding error handling nodes. This can help pinpoint exactly where the process is failing. Also, consider updating n8n and your Docker image to the latest versions, as I’ve seen similar bugs fixed in updates before.

Lastly, if all else fails, you could try recreating the workflow from scratch. Sometimes, workflow configurations can become corrupted, and starting fresh resolves the issue.