Skip to content

Workflow does not have 'workflow_dispatch' trigger although it is there

CI/CDtested on GitHub Actions, gh 2.103.3

If a workflow file is not valid YAML, GitHub does not read it at all – and only reports this in the browser. For the API there is then no workflow_dispatch trigger, even though it is in the file.

Symptom

gh workflow run wk.yml
could not create workflow dispatch event: HTTP 422: Workflow does not have 'workflow
_dispatch' trigger (https://api.github.com/repos/<du>/notes-actions/actions/workflows/…)

The file says on: workflow_dispatch – the trigger is there.

Diagnosis

A linter reads the file offline and shows the spot.

zizmor -q --offline .github/workflows/wk.yml 2>&1 | head -1
 WARN zizmor::registry::input: failed to parse input: mapping values are not allowed
in this context at line 9 column 26

Causes

": "Colon inside an unquoted value

In - run: echo "Status: alles gut" the colon followed by a space turns the rest into a second key – the file is no longer valid YAML.

- run: echo "Status: alles gut"

silentGitHub only reports it in the browser

An invalid workflow file creates no run and no error in the CLI – only the Actions page in the browser shows the parse message.

Fix

Put the whole command in single quotes, commit and start again.
- run: 'echo "Status: alles gut"'
gh workflow run wk.yml
https://github.com/<du>/notes-actions/actions/runs/41633565092

Don't: Keep rewriting the trigger – the problem is not in on: but somewhere else in the file.

▶
Break it yourself and find it – free
GitHub Actions hands-on, Day 15: find and fix eight broken workflows against the clock.
Go to day 15 →

FAQ

How do I catch this before pushing?

With zizmor or actionlint locally or in a pre-commit hook; both report parse errors with line and column.

When do I need quotes in YAML?

As soon as a value contains ": " or " #" or starts with characters such as *, &, !, { or [.

Related error patterns

More