You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh run rerun --failed fails with "its workflow file may be broken" when workflow not finished yet #9221
When gh run rerun --failed is invoked on a workflow that did not complete yet (and thus is not re-runnable at least in the web UI), the command prints "run .... cannot be rerun; its workflow file may be broken", which does not indicate actual reason of the failure
$ gh --version
gh version 2.50.0 (2024-05-29)
https://github.com/cli/cli/releases/tag/v2.50.0
Steps to reproduce the behavior
Create a workflow with multiple jobs so that one fails and one continues to run longer
Create a PR, wait for the to-be-failed job to fail
Obtain status checks for this PR e.g. with gh pr checks "${pr_link}" --json 'link,bucket' --jq 'map(. | select(.bucket == "fail")' -- the job is reported as failed
Obtain the run ID -- either from web UI or with something like gh pr checks "${pr_link}" --json 'link,bucket' --jq 'map(. | select(.bucket == "fail") | .link | sub(".*/runs/(?<id>[0-9]+)/job/[0-9]+$"; "\(.id)") ) | unique | .[]'
Attempt re-running the failed jobs: gh run rerun --failed "${run_id}"
Expected vs actual behavior
Expected: gh run rerun to print something indicating that workflow/run cannot be rerun before it finishes
Actual: message not indicating what the actual problem is
Activity
andyfeller commentedon Jul 30, 2024
Thanks for opening this bug report, @findepi! 🤗
Using the following workflow, I was able to reproduce this without involving a pull request:
which resulted in:
Full debug output from rerunning failed jobs
I believe the issue can be tracked back to the following code snippet; I think the
messagefrom the response should be used / provided to the user:cli/pkg/cmd/run/rerun/rerun.go
Lines 199 to 208 in b05bddc
artemisart commentedon Aug 16, 2024
I had the same issue, see https://github.com/orgs/community/discussions/67654#discussioncomment-8038649 for a workaround: calling a second workflow to wait and rerun the first one.
williammartin commentedon Apr 10, 2025
@andyfeller this looks very similar to b41b771, we should probably just remove the:
And return whatever the API does. This seems like a recipe for confusion as is.