I am getting a build error when I create a new branch and try to deploy the code in that branch

Hi, I have created a gatsby website which I have pushed to GitHub and have deployed on Netlify and works perfectly. I have created one branch ((lets call it “branch 1”) off the main which I am able to make changes and deploy to Netlify as a deploy preview. However, if I try to create a branch (“branch 2”) off of “branch 1” and I try to deploy the code on this branch on Netlify, I receive a build error (below) even though the code on “branch 2” is the exact same as the code on “branch 1”. I don’t understand why this error is coming up even though the code on both branches are exactly the same. Can anyone help with this please?

This error message typically indicates that you are trying to access the property ‘file’ on a null value.

  1. Check the variable that you are trying to access to make sure it is not null or undefined. You can use console.log() to print out the value of the variable and see if it is what you expect?
  2. Check the object you are trying to access the property on to make sure it exists and has the property you are trying to access.

Finally if none of that helps can you please share your site name and perhaps your repo? I also recommend you give this guide a read first: