Bug 297684

Summary: [EWS] checkout-pull-request step failed with an error stating that the branch already exists, worked on retry
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: aakash_jain, bfan2, gsnedders, jbedard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Ryan Haddad
Reported 2025-08-20 13:59:44 PDT
In https://ews-build.webkit.org/#/builders/121/builds/44570, the checkout-pull-request step failed with the following: ``` git remote set-url kmiller68 https://github.com/kmiller68/WebKit.git git fetch kmiller68 eng/Workers-should-handle-btoa-OOM-gracefully From https://github.com/kmiller68/WebKit * branch eng/Workers-should-handle-btoa-OOM-gracefully -> FETCH_HEAD * [new branch] eng/Workers-should-handle-btoa-OOM-gracefully -> kmiller68/eng/Workers-should-handle-btoa-OOM-gracefully git checkout -b eng/Workers-should-handle-btoa-OOM-gracefully fatal: a branch named 'eng/Workers-should-handle-btoa-OOM-gracefully' already exists ``` The build worked on a retry, so we should make our steps more resilient to this kind of error.
Attachments
Radar WebKit Bug Importer
Comment 1 2025-08-20 14:00:06 PDT
Aakash Jain
Comment 2 2025-08-20 14:51:51 PDT
the previous step `clean-up-git-repo` failed to delete that branch for some reason, see logs: error: Cannot delete branch 'eng/Workers-should-handle-btoa-OOM-gracefully' checked out at ... error: branch '*' not found. https://ews-build.webkit.org/#/builders/121/builds/44570/steps/4/logs/stdio
Sam Sneddon [:gsnedders]
Comment 3 2025-08-21 11:02:05 PDT
We have: ``` git checkout origin/main -f in dir /Volumes/Data/worker/visionOS-2-Simulator-Build-EWS/build (timeout 300 secs) watching logfiles {} argv: [b'git', b'checkout', b'origin/main', b'-f'] using PTY: False error: pathspec 'origin/main' did not match any file(s) known to git ``` This is slightly strange (it also shows the ambiguity problem of `git-checkout` given it's complaining about paths!) — but it implies we either have no `origin` or the `origin` has no `main` branch. Looking at the worker: ``` buildbot@ews221 ~ % git -C /Volumes/Data/worker/visionOS-2-Simulator-Build-EWS/build remote -v elijahsawyers https://github.com/elijahsawyers/WebKit.git (fetch) elijahsawyers https://github.com/elijahsawyers/WebKit.git (push) origin https://github.com/WebKit/WebKit.git (fetch) origin PUSH_DISABLED_BY_ADMIN (push) buildbot@ews221 ~ % git -C /Volumes/Data/worker/visionOS-2-Simulator-Build-EWS/build for-each-ref refs/heads refs/remotes 934f88404e9fa471e2254c6ddaef34af3fafe7a4 commit refs/heads/eng/REGRESSION-269745-main-Inserting-a-PathSeg-with-NaN-coordinates-into-a-path-element-can-result-in-NaN-StrokeBoundingBox 9490d860bc447da9a01f2505d49fec7a85d2db88 commit refs/heads/eng/esawyers/297338 934f88404e9fa471e2254c6ddaef34af3fafe7a4 commit refs/heads/main e2b825f6b6f7810ea1a61c80b599984dacf067b0 commit refs/remotes/elijahsawyers/eng/esawyers/297338 ``` So we have the remote configured — but we've either never fetched from it or we've deleted the branches we fetched from it. We don't seem to have logs far enough back to figure out how it got in this state, but it's been in this state for a while. And then, as Aakash mentioned before, because we don't have a detached HEAD: ``` /bin/bash --posix -o pipefail -c 'git branch | grep -v '"'"' main$'"'"' | grep -v '"'"'HEAD detached at'"'"' | xargs git branch -D || true' in dir /Volumes/Data/worker/visionOS-2-Simulator-Build-EWS/build (timeout 300 secs) watching logfiles {} argv: [b'/bin/bash', b'--posix', b'-o', b'pipefail', b'-c', b"git branch | grep -v ' main$' | grep -v 'HEAD detached at' | xargs git branch -D || true"] using PTY: False error: branch '*' not found. error: Cannot delete branch 'eng/Workers-should-handle-btoa-OOM-gracefully' checked out at '/Volumes/Data/worker/visionOS-2-Simulator-Build-EWS/build' Deleted branch eng/Avoid-GNU-folding-constant-warnings (was 49119822a1c1). ``` Some of the problem here is we're ending up with `*` because we're trying to parse the output of `git-branch` (a "porcelain" command). I expect what we want to do is something more like: ``` git for-each-ref --format='delete %(refname) %(objectname)' refs/heads | grep -v '^delete refs/heads/main ' | git-update-ref --stdin ``` (I'm also not entirely sure why exactly we're keeping any of our local branches?) But because we fail to move to a detached HEAD, we fail to delete the branch, and thus we can't create a new branch with the same name — so this only happens with the same PR in direct succession.
Aakash Jain
Comment 4 2026-02-04 07:51:51 PST
Fixed in https://commits.webkit.org/306516@main *** This bug has been marked as a duplicate of bug 306636 ***
Note You need to log in before you can comment on or make changes to this bug.