Skip to content

Some invalid workflow are not reported as invalid #37115

@kLiHz

Description

@kLiHz

Description

I noticed that since #23275, Gitea have been able to report invalid workflows to user. However, I've encountered issue with an ill-formed workflow file like this:

Name: invlalid workflow
jobs:
  test:
    steps:
      - run: |

          echo "Hello."

This might be a valid yaml (I tested on several online yaml validator), and Gitea is not reporting error for it. But in fact Gitea would have trouble processing that blank line right after - run: |.

Apr 05 18:47:53 machine_name gitea[70048]: 2026/04/05 18:47:53 .../actions/notifier_helper.go:364:handleWorkflows() [E] jobparser.Parse: SetJob: yaml: line 42: did not find expected key

The log is from a self-host instance and from a different workflow file, so the line number is unrelated.

The error message did not find expected key can also be confusing, until one realize it's a sign of yaml parsing error.

Since this workflow has a on: { workflow_dispatch: }, we can even click to run it, but will only got a 500 error.


I've create a repo containing two files on gitea.com:
https://gitea.com/kLiHz/test-invalid-workflow/src/branch/main/.gitea/workflows

another.yml is actually an invalid yaml which has wrong indentation, and Gitea is reporting that error. (though it may take some time for people to realize what that error mean)

invalid.yml actually seems to be an valid yaml, but Gitea doe not seem to be telling me about that.

Gitea Version

1.25.5

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

.

Database

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions