Fix GitHub Actions Missing Jobs Errors
Zusammenfassung
Pixel shares a guide to GitHub Actions workflows failing with Required property is missing: jobs. It explains how root-level indentation and lost workflow headers after a merge can hide the jobs key, and why checking other lines in the invalid-file annotation helps pinpoint the cause.
DEV Community
GitHub Actions Required property is missing: jobs
Required property is missing: jobs is the workflow parser telling you that the root of the file has no jobs key where it expects one. The key is usually present in the file and has simply stopped being at the root, which is why the message reads as absurd the first time you see it next to a file that obviously has jobs in it. The left panel is the root key table reproduced in the body of this page, read from workflow-v1.0.json in actions/runner. What this error means The workflow does not run and GitHub shows an invalid-file annotation against the commit. The reported position is normally the very start of the file, because a missing property is reported against the mapping that should have contained it rather than against any line you wrote. That makes the message unhelpful on its own: it tells you what is absent and nothing about where it went. Often there are other lines above it in the same annotation, one per key that ended up somewhere unexpected, and those lines are the useful ones. If the annotation contains nothing but this single line, the file has genuinely lost its jobs key, either because it was never added or because the block that held it was moved under another key. ```Actions annotation, the last line, quoted from just-another-job-application-tracker#208 Invalid workflow file: .github/workflows/deploy.yml#L1 (Line: 1, Col: 3): Required property is missing: jobs
Common causes
Stray indentation at the root of the file
One leading space on the first line is enough. Everything below it is then nested inside a document whose root mapping has no keys the schema recognizes, and the required-property check fires against a root that looks empty even though the file is full.
The header of the file was lost in a merge or a squash
The name, trigger and jobs keys live in the first few lines, and a badly resolved conflict or a rewritten branch can take all of them at once while leaving the job bodies behind. The annotation then reports every job id as an unexpected root key, with the missing-property line last.
The jobs block ended up under another key
Usually under the trigger block, and usually from an automatic reindent. The key is still spelled correctly and is still in the file, which is why searching for the word finds nothing wrong and reading the column number does.
The file is not a workflow at all
A linter configuration, an action manifest or a Dependabot file that has been saved into the workflows directory is read as a workflow and rejected. The message is the same, and the fix is to move the file out rather than to add a jobs key to it.
How to fix it
Check column one before anything else
- Open the file and confirm that the first character of the first key is at column one.
- Confirm the same for name, on and jobs, which all belong at the same level.
- If the annotation reported unexpected values as well, look at what those keys are: job ids there mean the wrapper is gone.
Restore the root keys
Put the header back and leave the job bodies alone. The corrected version of the illustrative file is below, with every root key flush left and the job indented under jobs.
```.github/workflows/deploy.yml, corrected (illustrative)
name: deploy
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: make
Give each job a valid identifier Once the key is back at the root, every entry under it is a job id, and the ids have rules. The documentation gives them: the identifier "must start with a letter or _ and contain only alphanumeric characters, -, or _". The schema does not enforce that rule. The loose key under jobs is typed only as a non-empty string, so a bad id is read without complaint and is rejected later, in the converter, by IdBuilder.TryAddKnownId. ```.github/workflows/deploy.yml (illustrative) jobs: build_and_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci && npm test
A...
Powered by Readybot.io
