YAML syntax and indentation
Encyclopedia home · Search machine-readable catalog
The broken snippets are deliberate negative examples. Use only in an isolated fixture repository or lab.
F001
Nested run key
Symptom. Parser or schema rejects steps.
Root cause. A step list was supplied as a mapping.
Broken example
steps:
run: echo helloCorrected example
steps:
- run: echo helloVerification. Validate that steps contains a single item and its log prints hello.
Correction validation syntax-validated.
F002
Tab indentation
Symptom. scanner error near tab.
Root cause. A tab is illegal in indentation.
Broken example
jobs:
test: {}Corrected example
jobs:
test: {}Verification. Replace tabs with spaces, then complete the test job as in the syntax guide.
Correction validation syntax-validated.
F003
Misaligned steps
Symptom. mapping values are not allowed here.
Root cause. steps must be a sibling of runs-on.
Broken example
sample:
runs-on: ubuntu-latest
steps: []Corrected example
sample:
runs-on: ubuntu-latest
steps:
- run: echo okVerification. Lint the workflow and inspect the sample job.
Correction validation syntax-validated.
F004
Unquoted colon in a command
Symptom. mapping values are not allowed here.
Root cause. The colon is interpreted as a mapping separator.
Broken example
run: echo Check: passedCorrected example
run: |
echo 'Check: passed'Verification. Confirm the step log prints Check: passed.
Correction validation syntax-validated.
F005
Unclosed flow list
Symptom. expected comma or closing bracket.
Root cause. A closing bracket is missing.
Broken example
branches: [main, releaseCorrected example
branches: [main, release]Verification. Parse and verify two branch names.
Correction validation syntax-validated.
F006
Duplicate job identifier
Symptom. one job disappears or lint rejects duplicate key.
Root cause. Duplicate keys can overwrite one job or be rejected.
Broken example
jobs:
test: {runs-on: ubuntu-latest}
test: {runs-on: windows-latest}Corrected example
jobs:
test-linux:
runs-on: ubuntu-latest
steps: [{run: echo linux}]
test-windows:
runs-on: windows-latest
steps: [{run: echo windows}]Verification. List both jobs in workflow UI.
Correction validation syntax-validated.
F007
Unquoted glob
Symptom. alias parser error.
Root cause. Asterisk begins a YAML alias token.
Broken example
paths: [**/*.py]Corrected example
paths: ["**/*.py"]Verification. Change src/main.py and verify a run.
Correction validation syntax-validated.
F008
Wrong boolean type
Symptom. unexpected string or incorrect behavior.
Root cause. A string was used where boolean or a typed expression is expected.
Broken example
continue-on-error: "false"Corrected example
continue-on-error: falseVerification. Cause a deliberate failure and verify it blocks the run.
Correction validation syntax-validated.
F009
Unindented here document in YAML
Symptom. yaml parsing fails before shell starts.
Root cause. YAML stripped indentation only from lines inside the block.
Broken example
run: |
cat <<'FIXTURE'
body
FIXTURECorrected example
run: |
cat <<'FIXTURE'
body
FIXTUREVerification. Verify stdout contains body.
Correction validation syntax-validated.
F010
Empty event mapped with an extra colon
Symptom. workflow config reports invalid event or never triggers.
Root cause. The event name accidentally contains a colon.
Broken example
on:
push::
workflow_dispatch:Corrected example
on:
push:
workflow_dispatch:Verification. Push and manually dispatch in a lab.
Correction validation syntax-validated.