mckaywrigley / buildware-ai

Come join the best place on the internet to learn AI skills. Use code "buildwareai" for an extra 20% off.
https://JoinTakeoff.com
MIT License
519 stars 72 forks source link

Error: Failed to run issue: Error: GitRPC::BadObjectState #29

Open RKeelan opened 2 months ago

RKeelan commented 2 months ago

I got Error: Failed to run issue: Error: GitRPC::BadObjectState - https://docs.github.com/rest/git/trees#create-a-tree when trying to run a simple PR.

Here is a screenshot of the error message: image

Here is an extract from the log:

GET /repos/RKeelan/Website/contents/Site%2Fstories.html?ref=buildware-ai%2FRename-Index.html%2F1722103982687 - 404 with id D41C:1A417E:D1F760:1843DF4:66A538AF in 225ms
File not found: Site/stories.html. Treating as new file.
POST /repos/RKeelan/Website/git/trees - 422 with id D41B:1D97B1:CB67CE:1785DB1:66A538AF in 207ms
 ⨯ HttpError: GitRPC::BadObjectState - https://docs.github.com/rest/git/trees#create-a-tree
    at async generatePR (./actions/github/generate-pr.ts:101:28)
digest: "560742415"
 POST /4263aac5-fec9-4629-bf7b-3352ec81b4b9/f80b0781-27f8-487b-b81a-ac9a029ee08a/issues/ea10275b-e32b-487c-988b-d2c32cc9b99b 500 in 1194ms
 POST /4263aac5-fec9-4629-bf7b-3352ec81b4b9/f80b0781-27f8-487b-b81a-ac9a029ee08a/issues/ea10275b-e32b-487c-988b-d2c32cc9b99b 200 in 361ms
 POST /4263aac5-fec9-4629-bf7b-3352ec81b4b9/f80b0781-27f8-487b-b81a-ac9a029ee08a/issues/ea10275b-e32b-487c-988b-d2c32cc9b99b 200 in 302ms

Buildware is running locally in Simple mode. This is the first issue I've attempted to run, so I can't rule out a permissions issue, but I did follow the simple setup instructions. I've checked the Postgres DB, and I see records in issues and issues_messages. I was able to reproduce the issue by re-running the PR.

RKeelan commented 2 months ago

I took a look at generate-pr.ts on the debugger and it looks like the PR that Buildware was trying to make had changes to three files:

The request I'm running is "Change the name of index.html to stories.html," so it seems like one problem is that the PR should be adding Site/stories.html as the first change. I tried modifying the path of the first change directly in the debugger, which resulted in a different error: TypeError: Cannot read properties of undefined (reading 'headers') (But it wouldn't surprise me at all if modifying the changes directly in the debugger like that broke something.

Perhaps updating the same path in two ways is what causes the GitRPC::BadObjectState? I don't know enough about GitHub's API to say.

RKeelan commented 2 months ago

(I pressed the wrong button for my previous comment)