[Bug] Nextcloud node - Move/Delete function throws an error

Hi,

I was trying to move a file from one Nextcloud location to another (different folder), but whenever I try to do that, I get the below error:

ERROR: NextCloud Error. Status Code: 404. Message: 404 - “<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<d:error xmlns:d=“DAV:” xmlns:s=“http://sabredav.org/ns”>\n <s:exception>Sabre\DAV\Exception\NotFound</s:exception>\n <s:message>File with name /Invoices/Sample.xlsx could not be located</s:message>\n</d:error>\n”

Here’s a sample workflow:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "Invoices/Sample.xlsx"
      },
      "name": "Nextcloud",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "nextCloudApi": "SD Cloud"
      }
    },
    {
      "parameters": {
        "options": {
          "rawData": true,
          "readAsString": false
        }
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = []\n\nfor(let item of items) {\n  item.json.activated_date = new Date(Math.round((item.json.activated_date - 25569)*86400*1000));\n  item.json.expiry_date = new Date(Math.round((item.json.expiry_date - 25569)*86400*1000));\n  item.json.file_name = `Sample${(new Date()).toISOString()}.xlsx`;\n  newItems.push(item);\n}\nreturn newItems;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "operation": "move",
        "path": "/Invoices/Sample.xlsx",
        "toPath": "=Processed/{{$node[\"Function\"].json[\"file_name\"]}}"
      },
      "name": "Nextcloud1",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {
        "nextCloudApi": "SD Cloud"
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Nextcloud",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Nextcloud1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Note that the same error occurs when I try to delete a file as well.

Thanks,
Santhosh

Welcome to the community @santhosh!

My assumption would be that the error message is correct and the file “/Invoices/Sample.xlsx” does not exist.

It’s working just fine for me.

Can you do /Invoices/Sample.xlsx instead of Invoices/Sample.xlsx? Perhaps that solves the issue.

My bad! Thanks Ricardo! That did the trick! Silly mistake, sorry for wasting your time.

Not wasting my time at all. Perhaps we improve the field description as it does not mention that. Actually you are making us to make the product better. Thanks.

1 Like

Hi @jan, @RicardoE105, it looks like I prematurely closed the issue. There’s definitely some issue with the Nextcloud node. I consistently get the above error now. Please note that I get the below error after the file gets moved to the target folder!

ERROR: NextCloud Error. Status Code: 404. Message: 404 - "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<d:error xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\">\n <s:exception>Sabre\\DAV\\Exception\\NotFound</s:exception>\n <s:message>File with name /SDConversations/Users.xlsx could not be located</s:message>\n</d:error>\n"

Can you please share the workflow? Just copy all the nodes and then paste them here, so that we can have a proper look.

Hi @RicardoE105, here’s the entire workflow:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "SDConversations/Users.xlsx"
      },
      "name": "Download users file",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "nextCloudApi": "SD Cloud"
      }
    },
    {
      "parameters": {
        "options": {
          "rawData": true,
          "readAsString": false
        }
      },
      "name": "Read list of users",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "operation": "move",
        "path": "SDConversations/Users.xlsx",
        "toPath": "=SDConversations/Processed/Users{{new Date().toISOString()}}.xlsx"
      },
      "name": "Move to processed folder",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        850,
        300
      ],
      "credentials": {
        "nextCloudApi": "SD Cloud"
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Download users file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download users file": {
      "main": [
        [
          {
            "node": "Read list of users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read list of users": {
      "main": [
        [
          {
            "node": "Move to processed folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}