n8n workflow stuck: data corruption and indefinite execution

I’m having trouble with my n8n workflow on a Docker container. It used to work fine but now it’s acting up. The workflow takes an image from a web UI and stores it on the server. But now when I trigger it, it just hangs forever and gives a 500 error. The n8n UI shows it as “running…” non-stop. The file does get written, but it’s corrupt and can’t be opened as an image.

The logs show some issue with moving the file from a temp folder to the final location. I’ve tried asking ChatGPT for help, but no luck. Any ideas on how to fix this or what might be causing it? I’d rather not start from scratch if I can avoid it.

Here’s a simplified version of my workflow:

{
  "nodes": [
    {
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [100, 200]
    },
    {
      "name": "API Endpoint",
      "type": "n8n-nodes-base.webhook",
      "position": [300, 200],
      "parameters": {
        "httpMethod": "PUT",
        "path": "upload-image"
      }
    },
    {
      "name": "Save Image",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [500, 200],
      "parameters": {
        "fileName": "=/uploads/{{ $json.filename }}.jpg"
      }
    }
  ]
}

Any help would be appreciated!

hey there swimmingshark, sounds like a tricky situation! have u tried clearing the n8n cache and restarting the docker container? sometimes that can help with weird hangs. also, maybe check ur disk space - if its full it could cause file corruption. good luck!

I’ve encountered similar issues with n8n workflows before, and it can be frustrating. One thing that’s worked for me is checking the file permissions on the Docker host. If the container doesn’t have proper write access to the destination folder, it could explain the hanging and corruption.

Another potential culprit could be network issues between the web UI and n8n. Try running a network diagnostic to ensure there’s no packet loss or latency spikes during file transfer.

Lastly, consider adding error handling nodes to your workflow. They can help pinpoint where exactly things are going wrong. You might want to add a ‘Function’ node after the ‘Save Image’ step to log detailed information about the file write process.

If all else fails, you might need to recreate the workflow, but export your current one first so you can reference it while rebuilding.