ERROR: Github error response [422]: Invalid request. "sha" wasn't supplied

This error comes when using Upload Binary File to GitHub option.

If the file is already present with the same name, This error happens.

ERROR: Github error response [422]: Invalid request. "sha" wasn't supplied.
Error: Github error response [422]: Invalid request.

"sha" wasn't supplied.
    at Object.githubApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Github/GenericFunctions.js:42:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Github/Github.node.js:1662:32)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:416:47

Any way to avoid this error?

Found this thread, Might be Useful:

https://github.com/octokit/octokit.net/issues/1725#issuecomment-350432398

I guess you have two options, depending on what you want to do.

  1. Delete the file before uploading a change.

  2. Check if the file exists; if it does, then do not update it.

Thanks bro. Solved

Hi, How are you able to solve it? i’m also facing same issue, i have a file present in git and wanted to update it with new content but getting following error

422 - {“message”:“content is not valid Base64”,“documentation_url”:“REST API endpoints for repository contents - GitHub Docs”} - content is not valid Base64

I’m using Github node with Edit Operation

Hey @Paddy_Pohare

This post is a bit old now, can you create a new topic and complete the template so we can take a look?

For now I am going to lock this one due to the age of it.