n8n workflow execution hanging and writing corrupt data - Stack Overflow

admin2025-04-29  1

I have n8n running on docker on a local server. There is a simple workflow (JSON included below with api key redacted) that involves a Webhook node passing data from an API PUT call to a write-to-binary node. The write-to-binary node writes to a directory on the container that is mounted to a local directory on the server running docker. It is meant to take an image file from a file upload prompt on a web UI and store it on the server. This has been working for a while, but recently stopped working after I tried to make some changes on the docker container (installing exif-parsing library). Unfortunately I am having trouble undoing whatever I've done and am at a loss with regards to fixing it. I can rebuild from scratch, but am hesitant to since I've made a number of modification from the typical install process and am worried I won't be able to replicate.

The details of the execution failure are that when the execution is triggered by the API call, it hangs indefinitely, returning a 500 error response to the API call. If I go to the executions page on the n8n management UI, I see that the execution is stuck in a perpetual "running..." state. When I go to the directory that should be getting the file, I see that there is a file that was written there (roughly correct size) but it is corrupt (can't be read as image file). The n8n logs are showing that there was a problem when writing the binary data from the tmp folder to the binary_data folder, but I don't know what it means since the file is indeed getting written (for example, the 115 execution directory from the log below is present with the binary file in).

How can I troubleshoot this further? Any ideas to cause? I've chat-gpt'ed it to death and am getting nowhere. Here are the logs:

n8n_1      | 2025-01-06T22:46:03.643Z | verbose  | Execution for workflow upload-observation-image was assigned id 115 "{\n  executionId: '115',\n  file: 'WorkflowRunner.js',\n  function: 'runMainProcess'\n}"
n8n_1      | 2025-01-06T22:46:03.659Z | debug    | Execution ID 115 had Execution data. Running with payload. "{\n  executionId: '115',\n  file: 'WorkflowRunner.js',\n  function: 'runMainProcess'\n}"
n8n_1      | 2025-01-06T22:46:03.659Z | verbose  | Workflow execution started "{\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.verbose'\n}"
n8n_1      | 2025-01-06T22:46:03.660Z | debug    | Executing hook (hookFunctionsPush) "{\n  executionId: '115',\n  sessionId: undefined,\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteBefore'\n}"
n8n_1      | 2025-01-06T22:46:03.663Z | verbose  | Started execution of workflow "upload-observation-image" from webhook with execution ID 115 "{\n  executionId: '115',\n  file: 'WebhookHelpers.js',\n  function: 'executeWebhook'\n}"
n8n_1      | 2025-01-06T22:46:03.664Z | debug    | Start processing node "Webhook" "{\n  node: 'Webhook',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.665Z | debug    | Running node "Webhook" started "{\n  node: 'Webhook',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.665Z | debug    | Running node "Webhook" finished successfully "{\n  node: 'Webhook',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.667Z | debug    | Start processing node "Write Binary File" "{\n  node: 'Write Binary File',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.667Z | debug    | Running node "Write Binary File" started "{\n  node: 'Write Binary File',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.687Z | debug    | Running node "Write Binary File" finished successfully "{\n  node: 'Write Binary File',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.debug'\n}"
n8n_1      | 2025-01-06T22:46:03.688Z | verbose  | Workflow execution finished successfully "{\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'LoggerProxy.js',\n  function: 'exports.verbose'\n}"
n8n_1      | 2025-01-06T22:46:03.689Z | debug    | Executing hook (hookFunctionsSave) "{\n  executionId: '115',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
n8n_1      | 2025-01-06T22:46:03.692Z | debug    | Executing hook (hookFunctionsSave) "{\n  executionId: '115',\n  workflowId: 'P82M5fZvGYlHRfSZ',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
n8n_1      | There was a problem running hook "workflowExecuteAfter" [Error: ENOENT: no such file or directory, rename '/home/node/.n8n/binaryData/workflows/P82M5fZvGYlHRfSZ/executions/temp/binary_data/c5ae79f3-7c4a-4366-9d3d-8b5e995056be' -> '/home/node/.n8n/binaryData/workflows/P82M5fZvGYlHRfSZ/executions/115/binary_data/c5ae79f3-7c4a-4366-9d3d-8b5e995056be'] {
n8n_1      |   errno: -2,
n8n_1      |   code: 'ENOENT',
n8n_1      |   syscall: 'rename',
n8n_1      |   path: '/home/node/.n8n/binaryData/workflows/P82M5fZvGYlHRfSZ/executions/temp/binary_data/c5ae79f3-7c4a-4366-9d3d-8b5e995056be',
n8n_1      |   dest: '/home/node/.n8n/binaryData/workflows/P82M5fZvGYlHRfSZ/executions/115/binary_data/c5ae79f3-7c4a-4366-9d3d-8b5e995056be'
n8n_1      | }
  "name": "upload-observation-image",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        200,
        480
      ],
      "id": "d398c9b6-be9f-44d2-8a8f-35738f91dd18"
    },
    {
      "parameters": {
        "fileName": "=/files/field-journal/icons/{{ $json.query.filename }}.jpg",
        "dataPropertyName": "=data",
        "options": {}
      },
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "typeVersion": 1,
      "position": [
        940,
        460
      ],
      "id": "24b692d4-4201-4244-8793-3dd42685a1a9"
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "httpMethod": "PUT",
        "path": "nature-observation-icons",
        "responseMode": "lastNode",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        460,
        460
      ],
      "webhookId": "02d82240-6067-4f76-b8de-72f257d0e837",
      "id": "da81d16e-63a0-479d-97c1-0053a6c5ed00",
      "credentials": {
        "httpHeaderAuth": {
          "id": "------------------",
          "name": "appsmith-api-key"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ade4994c-c4aa-4ce9-9074-827ddea1f185",
  "id": "P82M5fZvGYlHRfSZ",
  "meta": {
    "instanceId": "3340819aad0dcf645ceb209f73491a6d6fc3d8b4abe01b5a71da637fbd626194"
  },
  "tags": []
}```

转载请注明原文地址:http://anycun.com/QandA/1745940452a91413.html