Error An unexpected error occurred: "Commit hash required"

I am trying to deploy my project from github and getting the error :
error An unexpected error occurred: “Commit hash required”

Seems to be a problem with dependencies but need help

my netlify name is : effortless-conkies-c23bc6

the log is pasted below:

7:46:06 PM: Waiting for other deploys from your team to complete. Check the queue: Netlify App

7:46:32 PM: Build ready to start

7:46:34 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)

7:46:34 PM: build-image tag: v4.10.1

7:46:34 PM: buildbot version: 3f3056558a30449e4099db9c1a8b041604d2b6f5

7:46:35 PM: Building without cache

7:46:35 PM: Starting to prepare the repo for build

7:46:35 PM: No cached dependencies found. Cloning fresh repo

7:46:35 PM: git clone https://github.com/pbirbarah/NFE

7:46:36 PM: Preparing Git Reference refs/heads/main

7:46:37 PM: Parsing package.json dependencies

7:46:38 PM: Starting build script

7:46:38 PM: Installing dependencies

7:46:38 PM: Python version set to 2.7

7:46:38 PM: Downloading and installing node v16.17.0…

7:46:38 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz

7:46:39 PM: Computing checksum with sha256sum

7:46:39 PM: Checksums matched!

7:46:41 PM: Now using node v16.17.0 (npm v8.15.0)

7:46:41 PM: Started restoring cached build plugins

7:46:41 PM: Finished restoring cached build plugins

7:46:41 PM: Attempting ruby version 2.7.2, read from environment

7:46:42 PM: Using ruby version 2.7.2

7:46:42 PM: Using PHP version 8.0

7:46:42 PM: Started restoring cached yarn cache

7:46:42 PM: Finished restoring cached yarn cache

7:46:42 PM: No yarn workspaces detected

7:46:42 PM: Started restoring cached node modules

7:46:42 PM: Finished restoring cached node modules

7:46:42 PM: Installing NPM modules using Yarn version 1.22.10

7:46:42 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

7:46:42 PM: npm WARN config location in the cache, and they are managed by

7:46:42 PM: npm WARN config cacache.

7:46:43 PM: yarn install v1.22.10

7:46:43 PM: [1/4] Resolving packages…

7:46:43 PM: warning react-scripts > webpack-dev-server > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

7:46:43 PM: [2/4] Fetching packages…

7:46:47 PM: error An unexpected error occurred: “Commit hash required”.

7:46:47 PM: info If you think this is a bug, please open a bug report with the information provided in “/opt/build/repo/yarn-error.log”.

7:46:47 PM: info Visit yarn install | Yarn for documentation about this command.

7:47:06 PM: Error during Yarn install

7:47:06 PM: Build was terminated: Build script returned non-zero exit code: 1

7:47:06 PM: Creating deploy upload records

7:47:06 PM: Failing build: Failed to build site

7:47:06 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)

7:47:06 PM: Finished processing build request in 31.881170593s

Hey @pbirbarah

It appears this is an issue with yarn. There are a few possible solutions offered in this issue.

hello thanks for your reply,
I saw that thread but not sure how to tackle it from netlify. some solutions suggest running commands for git but from my understanding netlify deploys automatically so I cannot run commands manually?

Depending on the git command, likely you would run this on your computer, the push to origin.

I tried the git checkout it didn’t work, does anyone in the netlify team know how to solve this??

I don’t see anything about git checkout in that issue. Mind elaborating on where you found this, and what exactly you have tried?

Have you tried the last suggestion of deleting the yarn.lock file, running git stash or committing changes?

Note, this isn’t an Netlify-specific issue here, this is an issue with yarn.

that one actually helped! thanks coel, I will proceed with the deploy to see if I get any remaining issues

1 Like

Thanks for getting @pbirbarah on the right path, @coelmay. Don’t hesitate to follow up on this thread if you have further questions, @pbirbarah :raised_hands: