GitHub Actions "Cannot trigger workflow_dispatch - workflow not on default branch"
The manual Run workflow UI and the workflow_dispatch trigger only become available once the workflow file declaring on: workflow_dispatch exists on the default branch. A dispatch-only feature branch will not show the button.
What this error means
The Run workflow button is absent, or an API dispatch fails because the workflow cannot be triggered.
github-actions
Error: Cannot trigger a workflow_dispatch on a workflow that does not exist on the default branch.
The workflow file with on: workflow_dispatch must be present on the default branch.Common causes
workflow_dispatch only on a feature branch
GitHub reads the dispatch trigger from the default branch; if it is not there, no dispatch is offered.
How to fix it
Add the dispatch trigger to the default branch
- Merge the workflow (with on: workflow_dispatch) to the default branch.
- The Run workflow button then appears and you can choose a ref to run on.
.github/workflows/manual.yml
on:
workflow_dispatch:
inputs:
env:
type: choice
options: [dev, prod]How to prevent it
- Land dispatch triggers on the default branch first.
- Remember the trigger definition is read from the default branch, even if you run other refs.
Related guides
GitHub Actions "The requested workflow was not found at ref"Fix "The requested workflow was not found" when dispatching or referencing a workflow that does not exist on…
GitHub Actions workflow_dispatch Missing - Only Runs from Default BranchFix a missing GitHub Actions "Run workflow" button - workflow_dispatch must exist on the default branch first…
GitHub Actions "Workflow does not exist" (workflow_dispatch on non-default branch)Fix "Workflow does not exist" when dispatching - workflow_dispatch is only available once the workflow file e…