Handle 404 for Github

I have built a fairly complex GitHub workflow, and this is the last piece (possibly). I am using the GitHub Get File Node to get the contents of a file in a repo and store it. The file list is fetched by getting files changed in commits and then using the file path to get the file contents.

Some commits will remove files, and this is where the problem is.

When the file is removed, the Get File node fails with a 404 error. This leads to the workflow failing.

I would like to know if there is a way to handle this error and continue the workflow execution if the file is not found.

I just want to be able to handle error similar to how you can do in an HTTP node where you send the error to a different node and if you want to continue the workflow, you can do so.

Note: I do get the files status like “remove” “added” etc, but since I am dealing with mutliple commits and merging them together a file removed in 1 commit can be added back by another commit and vice versa, so status aren’t useful unless I add more steps like sorting commits by date and then merging files smartly possibly using a code node.

  • n8n version:
    1.40.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not sure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): : Docker
  • Operating system:: Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Nik_S,

Welcome to the community :raised_hands:

What I do is under the Settings for the node there is an option to always output data, What this will do is just carry on if there are any issues so you can then use an if node to check if {{ $json.error }} exists so on your true output it will have the errors and on the false the items you are after.

Hi @Jon

Thanks for your reply.

I am not seeing an option to always output data with this node.
I have seen it with some other nodes but this one doesn’t have it.

It it had something like this then it could have been really helpful.

Hey @Nik_S,

Below is a snip of the options I set in the GitHub node, It should be in yours as well.

Oh Wow - I see these options now. Not sure why I wasn’t seeing them earlier!
Thanks for your help here @Jon

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.