Skip to content

gh run rerun --failed fails with "its workflow file may be broken" when workflow not finished yet #9221

Description

@findepi

Describe the bug

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

  1. Create a workflow with multiple jobs so that one fails and one continues to run longer
  2. Create a PR, wait for the to-be-failed job to fail
  3. 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
  4. 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 | .[]'
  5. 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

  1. andyfeller commented on Jul 30, 2024

    @andyfeller
    Contributor

    Thanks for opening this bug report, @findepi! 🤗

    Using the following workflow, I was able to reproduce this without involving a pull request:

    on:
      workflow_dispatch:
    jobs:
      long-running:
        runs-on: ubuntu-latest
        steps:
          - name: Delay
            run: |
              sleep 300
      short-failing:
        runs-on: ubuntu-latest
        steps:
          - name: Delay
            run: |
              sleep 60
          - name: Fail
            run: |
              exit 1

    which resulted in:

    < HTTP/2.0 403 Forbidden
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Tue, 30 Jul 2024 18:54:02 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: 
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Api-Version-Selected: 2022-11-28
    < X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: E3D3:ED6FF:6FAA10:D07726:66A936CA
    < X-Oauth-Client-Id: 178c6fc778ccc68e1d6a
    < X-Oauth-Scopes: codespace, gist, project, read:org, repo, workflow
    < X-Ratelimit-Limit: 15000
    < X-Ratelimit-Remaining: 14982
    < X-Ratelimit-Reset: 1722369142
    < X-Ratelimit-Resource: core
    < X-Ratelimit-Used: 18
    < X-Xss-Protection: 0
    
    {
      "message": "This workflow is already running",
      "documentation_url": "https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run",
      "status": "403"
    }
    
    * Request took 118.392833ms
    run 10168088985 cannot be rerun; its workflow file may be broken
    Full debug output from rerunning failed jobs

    andyfeller@Andys-MBP:tinyfists/actions-experiments ‹main›$ GH_DEBUG=api gh run rerun 10168088985 --failed
    [git remote -v]
    [git config --get-regexp ^remote\..*\.gh-resolved$]
    ⣾* Request at 2024-07-30 14:54:01.934144 -0400 EDT m=+0.083731709
    * Request to https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985?exclude_pull_requests=true
    > GET /repos/tinyfists/actions-experiments/actions/runs/10168088985?exclude_pull_requests=true HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token ████████████████████
    > Content-Type: application/json; charset=utf-8
    > Time-Zone: America/New_York
    > User-Agent: GitHub CLI 2.52.0
    
    ⣽< HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Cache-Control: private, max-age=60, s-maxage=60
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Tue, 30 Jul 2024 18:54:02 GMT
    < Etag: W/"b4d532226b977680761313d8e5eeed26e89a2d779efc0cce6f4f39519b920a23"
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: 
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Api-Version-Selected: 2022-11-28
    < X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: E3D3:ED6FF:6FA8FF:D07546:66A936CA
    < X-Oauth-Client-Id: 178c6fc778ccc68e1d6a
    < X-Oauth-Scopes: codespace, gist, project, read:org, repo, workflow
    < X-Ratelimit-Limit: 15000
    < X-Ratelimit-Remaining: 14984
    < X-Ratelimit-Reset: 1722369142
    < X-Ratelimit-Resource: core
    < X-Ratelimit-Used: 16
    < X-Xss-Protection: 0
    
    {
      "id": 10168088985,
      "name": ".github/workflows/cli-9221.yml",
      "node_id": "WFR_kwLOIVGots8AAAACXhC5mQ",
      "head_branch": "main",
      "head_sha": "f868aa71d5ef0d60dc692b6a73891887ec2dc624",
      "path": ".github/workflows/cli-9221.yml",
      "display_title": ".github/workflows/cli-9221.yml",
      "run_number": 1,
      "event": "workflow_dispatch",
      "status": "in_progress",
      "conclusion": null,
      "workflow_id": 109990972,
      "check_suite_id": 26606595224,
      "check_suite_node_id": "CS_kwDOIVGots8AAAAGMeBsmA",
      "url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985",
      "html_url": "https://github.com/tinyfists/actions-experiments/actions/runs/10168088985",
      "pull_requests": [],
      "created_at": "2024-07-30T18:51:31Z",
      "updated_at": "2024-07-30T18:51:42Z",
      "actor": {
        "login": "andyfeller",
        "id": 2089743,
        "node_id": "MDQ6VXNlcjIwODk3NDM=",
        "avatar_url": "https://avatars.githubusercontent.com/u/2089743?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/andyfeller",
        "html_url": "https://github.com/andyfeller",
        "followers_url": "https://api.github.com/users/andyfeller/followers",
        "following_url": "https://api.github.com/users/andyfeller/following{/other_user}",
        "gists_url": "https://api.github.com/users/andyfeller/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/andyfeller/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/andyfeller/subscriptions",
        "organizations_url": "https://api.github.com/users/andyfeller/orgs",
        "repos_url": "https://api.github.com/users/andyfeller/repos",
        "events_url": "https://api.github.com/users/andyfeller/events{/privacy}",
        "received_events_url": "https://api.github.com/users/andyfeller/received_events",
        "type": "User",
        "site_admin": true
      },
      "run_attempt": 1,
      "referenced_workflows": [],
      "run_started_at": "2024-07-30T18:51:31Z",
      "triggering_actor": {
        "login": "andyfeller",
        "id": 2089743,
        "node_id": "MDQ6VXNlcjIwODk3NDM=",
        "avatar_url": "https://avatars.githubusercontent.com/u/2089743?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/andyfeller",
        "html_url": "https://github.com/andyfeller",
        "followers_url": "https://api.github.com/users/andyfeller/followers",
        "following_url": "https://api.github.com/users/andyfeller/following{/other_user}",
        "gists_url": "https://api.github.com/users/andyfeller/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/andyfeller/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/andyfeller/subscriptions",
        "organizations_url": "https://api.github.com/users/andyfeller/orgs",
        "repos_url": "https://api.github.com/users/andyfeller/repos",
        "events_url": "https://api.github.com/users/andyfeller/events{/privacy}",
        "received_events_url": "https://api.github.com/users/andyfeller/received_events",
        "type": "User",
        "site_admin": true
      },
      "jobs_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/jobs",
      "logs_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/logs",
      "check_suite_url": "https://api.github.com/repos/tinyfists/actions-experiments/check-suites/26606595224",
      "artifacts_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/artifacts",
      "cancel_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/cancel",
      "rerun_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/rerun",
      "previous_attempt_url": null,
      "workflow_url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/workflows/109990972",
      "head_commit": {
        "id": "f868aa71d5ef0d60dc692b6a73891887ec2dc624",
        "tree_id": "3621b7f9d3aca60b87dc82715da5e11fd324f883",
        "message": "Create cli-9221.yml",
        "timestamp": "2024-07-30T18:50:57Z",
        "author": {
          "name": "Andy Feller",
          "email": "[email protected]"
        },
        "committer": {
          "name": "GitHub",
          "email": "[email protected]"
        }
      },
      "repository": {
        "id": 558999734,
        "node_id": "R_kgDOIVGotg",
        "name": "actions-experiments",
        "full_name": "tinyfists/actions-experiments",
        "private": true,
        "owner": {
          "login": "tinyfists",
          "id": 90800543,
          "node_id": "MDEyOk9yZ2FuaXphdGlvbjkwODAwNTQz",
          "avatar_url": "https://avatars.githubusercontent.com/u/90800543?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/tinyfists",
          "html_url": "https://github.com/tinyfists",
          "followers_url": "https://api.github.com/users/tinyfists/followers",
          "following_url": "https://api.github.com/users/tinyfists/following{/other_user}",
          "gists_url": "https://api.github.com/users/tinyfists/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/tinyfists/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/tinyfists/subscriptions",
          "organizations_url": "https://api.github.com/users/tinyfists/orgs",
          "repos_url": "https://api.github.com/users/tinyfists/repos",
          "events_url": "https://api.github.com/users/tinyfists/events{/privacy}",
          "received_events_url": "https://api.github.com/users/tinyfists/received_events",
          "type": "Organization",
          "site_admin": false
        },
        "html_url": "https://github.com/tinyfists/actions-experiments",
        "description": "Collection of GitHub Action workflows for experimenting with various techniques.",
        "fork": false,
        "url": "https://api.github.com/repos/tinyfists/actions-experiments",
        "forks_url": "https://api.github.com/repos/tinyfists/actions-experiments/forks",
        "keys_url": "https://api.github.com/repos/tinyfists/actions-experiments/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/tinyfists/actions-experiments/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/tinyfists/actions-experiments/teams",
        "hooks_url": "https://api.github.com/repos/tinyfists/actions-experiments/hooks",
        "issue_events_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues/events{/number}",
        "events_url": "https://api.github.com/repos/tinyfists/actions-experiments/events",
        "assignees_url": "https://api.github.com/repos/tinyfists/actions-experiments/assignees{/user}",
        "branches_url": "https://api.github.com/repos/tinyfists/actions-experiments/branches{/branch}",
        "tags_url": "https://api.github.com/repos/tinyfists/actions-experiments/tags",
        "blobs_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/tinyfists/actions-experiments/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/tinyfists/actions-experiments/languages",
        "stargazers_url": "https://api.github.com/repos/tinyfists/actions-experiments/stargazers",
        "contributors_url": "https://api.github.com/repos/tinyfists/actions-experiments/contributors",
        "subscribers_url": "https://api.github.com/repos/tinyfists/actions-experiments/subscribers",
        "subscription_url": "https://api.github.com/repos/tinyfists/actions-experiments/subscription",
        "commits_url": "https://api.github.com/repos/tinyfists/actions-experiments/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/tinyfists/actions-experiments/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/tinyfists/actions-experiments/contents/{+path}",
        "compare_url": "https://api.github.com/repos/tinyfists/actions-experiments/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/tinyfists/actions-experiments/merges",
        "archive_url": "https://api.github.com/repos/tinyfists/actions-experiments/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/tinyfists/actions-experiments/downloads",
        "issues_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues{/number}",
        "pulls_url": "https://api.github.com/repos/tinyfists/actions-experiments/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/tinyfists/actions-experiments/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/tinyfists/actions-experiments/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/tinyfists/actions-experiments/labels{/name}",
        "releases_url": "https://api.github.com/repos/tinyfists/actions-experiments/releases{/id}",
        "deployments_url": "https://api.github.com/repos/tinyfists/actions-experiments/deployments"
      },
      "head_repository": {
        "id": 558999734,
        "node_id": "R_kgDOIVGotg",
        "name": "actions-experiments",
        "full_name": "tinyfists/actions-experiments",
        "private": true,
        "owner": {
          "login": "tinyfists",
          "id": 90800543,
          "node_id": "MDEyOk9yZ2FuaXphdGlvbjkwODAwNTQz",
          "avatar_url": "https://avatars.githubusercontent.com/u/90800543?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/tinyfists",
          "html_url": "https://github.com/tinyfists",
          "followers_url": "https://api.github.com/users/tinyfists/followers",
          "following_url": "https://api.github.com/users/tinyfists/following{/other_user}",
          "gists_url": "https://api.github.com/users/tinyfists/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/tinyfists/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/tinyfists/subscriptions",
          "organizations_url": "https://api.github.com/users/tinyfists/orgs",
          "repos_url": "https://api.github.com/users/tinyfists/repos",
          "events_url": "https://api.github.com/users/tinyfists/events{/privacy}",
          "received_events_url": "https://api.github.com/users/tinyfists/received_events",
          "type": "Organization",
          "site_admin": false
        },
        "html_url": "https://github.com/tinyfists/actions-experiments",
        "description": "Collection of GitHub Action workflows for experimenting with various techniques.",
        "fork": false,
        "url": "https://api.github.com/repos/tinyfists/actions-experiments",
        "forks_url": "https://api.github.com/repos/tinyfists/actions-experiments/forks",
        "keys_url": "https://api.github.com/repos/tinyfists/actions-experiments/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/tinyfists/actions-experiments/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/tinyfists/actions-experiments/teams",
        "hooks_url": "https://api.github.com/repos/tinyfists/actions-experiments/hooks",
        "issue_events_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues/events{/number}",
        "events_url": "https://api.github.com/repos/tinyfists/actions-experiments/events",
        "assignees_url": "https://api.github.com/repos/tinyfists/actions-experiments/assignees{/user}",
        "branches_url": "https://api.github.com/repos/tinyfists/actions-experiments/branches{/branch}",
        "tags_url": "https://api.github.com/repos/tinyfists/actions-experiments/tags",
        "blobs_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/tinyfists/actions-experiments/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/tinyfists/actions-experiments/languages",
        "stargazers_url": "https://api.github.com/repos/tinyfists/actions-experiments/stargazers",
        "contributors_url": "https://api.github.com/repos/tinyfists/actions-experiments/contributors",
        "subscribers_url": "https://api.github.com/repos/tinyfists/actions-experiments/subscribers",
        "subscription_url": "https://api.github.com/repos/tinyfists/actions-experiments/subscription",
        "commits_url": "https://api.github.com/repos/tinyfists/actions-experiments/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/tinyfists/actions-experiments/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/tinyfists/actions-experiments/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/tinyfists/actions-experiments/contents/{+path}",
        "compare_url": "https://api.github.com/repos/tinyfists/actions-experiments/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/tinyfists/actions-experiments/merges",
        "archive_url": "https://api.github.com/repos/tinyfists/actions-experiments/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/tinyfists/actions-experiments/downloads",
        "issues_url": "https://api.github.com/repos/tinyfists/actions-experiments/issues{/number}",
        "pulls_url": "https://api.github.com/repos/tinyfists/actions-experiments/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/tinyfists/actions-experiments/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/tinyfists/actions-experiments/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/tinyfists/actions-experiments/labels{/name}",
        "releases_url": "https://api.github.com/repos/tinyfists/actions-experiments/releases{/id}",
        "deployments_url": "https://api.github.com/repos/tinyfists/actions-experiments/deployments"
      }
    }
    
    * Request took 198.621417ms
    ⣻* Request at 2024-07-30 14:54:02.174297 -0400 EDT m=+0.323885209
    * Request to https://api.github.com/repos/tinyfists/actions-experiments/actions/workflows/109990972
    > GET /repos/tinyfists/actions-experiments/actions/workflows/109990972 HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token ████████████████████
    > Content-Type: application/json; charset=utf-8
    > Time-Zone: America/New_York
    > User-Agent: GitHub CLI 2.52.0
    
    ⢿< HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Cache-Control: private, max-age=60, s-maxage=60
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Tue, 30 Jul 2024 18:54:02 GMT
    < Etag: W/"9a90c525307654e4889f544427d7871fda0d09e345d2dcca932c25e11b7190cc"
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: 
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Api-Version-Selected: 2022-11-28
    < X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: E3D3:ED6FF:6FA994:D0763D:66A936CA
    < X-Oauth-Client-Id: 178c6fc778ccc68e1d6a
    < X-Oauth-Scopes: codespace, gist, project, read:org, repo, workflow
    < X-Ratelimit-Limit: 15000
    < X-Ratelimit-Remaining: 14983
    < X-Ratelimit-Reset: 1722369142
    < X-Ratelimit-Resource: core
    < X-Ratelimit-Used: 17
    < X-Xss-Protection: 0
    
    {
      "id": 109990972,
      "node_id": "W_kwDOIVGots4GjlQ8",
      "name": ".github/workflows/cli-9221.yml",
      "path": ".github/workflows/cli-9221.yml",
      "state": "active",
      "created_at": "2024-07-30T14:50:58.000-04:00",
      "updated_at": "2024-07-30T14:50:58.000-04:00",
      "url": "https://api.github.com/repos/tinyfists/actions-experiments/actions/workflows/109990972",
      "html_url": "https://github.com/tinyfists/actions-experiments/blob/main/.github/workflows/cli-9221.yml",
      "badge_url": "https://github.com/tinyfists/actions-experiments/workflows/.github/workflows/cli-9221.yml/badge.svg"
    }
    
    * Request took 115.547917ms
    * Request at 2024-07-30 14:54:02.336669 -0400 EDT m=+0.486256959
    * Request to https://api.github.com/repos/tinyfists/actions-experiments/actions/runs/10168088985/rerun-failed-jobs
    > POST /repos/tinyfists/actions-experiments/actions/runs/10168088985/rerun-failed-jobs HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token ████████████████████
    > Content-Type: application/json; charset=utf-8
    > Time-Zone: America/New_York
    > User-Agent: GitHub CLI 2.52.0
    
    < HTTP/2.0 403 Forbidden
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Tue, 30 Jul 2024 18:54:02 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: 
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Api-Version-Selected: 2022-11-28
    < X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: E3D3:ED6FF:6FAA10:D07726:66A936CA
    < X-Oauth-Client-Id: 178c6fc778ccc68e1d6a
    < X-Oauth-Scopes: codespace, gist, project, read:org, repo, workflow
    < X-Ratelimit-Limit: 15000
    < X-Ratelimit-Remaining: 14982
    < X-Ratelimit-Reset: 1722369142
    < X-Ratelimit-Resource: core
    < X-Ratelimit-Used: 18
    < X-Xss-Protection: 0
    
    {
      "message": "This workflow is already running",
      "documentation_url": "https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run",
      "status": "403"
    }
    
    * Request took 118.392833ms
    run 10168088985 cannot be rerun; its workflow file may be broken

    I believe the issue can be tracked back to the following code snippet; I think the message from the response should be used / provided to the user:

    path := fmt.Sprintf("repos/%s/actions/runs/%d/%s", ghrepo.FullName(repo), run.ID, runVerb)
    err = client.REST(repo.RepoHost(), "POST", path, body, nil)
    if err != nil {
    var httpError api.HTTPError
    if errors.As(err, &httpError) && httpError.StatusCode == 403 {
    return fmt.Errorf("run %d cannot be rerun; its workflow file may be broken", run.ID)
    }
    return fmt.Errorf("failed to rerun: %w", err)
    }

  2. added
    priority-3Affects a small number of users or is largely cosmetic
    and removed on Jul 30, 2024
  3. artemisart commented on Aug 16, 2024

    @artemisart

    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.

  4. williammartin commented on Apr 10, 2025

    @williammartin
    Member

    @andyfeller this looks very similar to b41b771, we should probably just remove the:

     fmt.Errorf("run %d cannot be rerun; its workflow file may be broken", run.ID)
    

    And return whatever the API does. This seems like a recipe for confusion as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-runrelating to the gh run commandhelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions