# GitHub Actions: Invalid workflow file: .github/workflows/ci.yml#L12 — You have an error in your yaml syntax on line 12

**Code:** `Invalid workflow file` · **Category:** CI/CD · **Seen on:** GitHub Actions, Linux

GitHub could not parse your workflow YAML, so no run was created — usually indentation, a tab, or an unquoted special character.

## Meaning

The Actions tab shows a red banner with the file and line. YAML is strict: indentation must use spaces, a colon followed by a space starts a value, and strings that contain `:`, `#`, `*`, `{` or start with `%` or `@` must be quoted. Wrong keys (`runs_on`) give a different "unexpected value" error but the same banner.

## Common causes

- Tab characters or inconsistent indentation
- Unquoted string containing `: `, `#` or a leading `*` / `@` / `%`
- Misspelled or misplaced key (`runs_on`, `step:` instead of `steps:`)
- Expression `${{ }}` with unbalanced braces or quotes
- Duplicate keys or a list item at the wrong level

## Quick fix

1. Go to the line number in the message and check indentation first
2. Quote values that contain `:` or `#`
3. Lint locally with `actionlint` or `yamllint` before pushing

## Detailed fix by platform

### GitHub Actions

1. Install actionlint and run `actionlint` in the repo root (also available as a pre-commit hook and VS Code extension)

### Linux

1. `python3 -c "import yaml,sys; yaml.safe_load(open('.github/workflows/ci.yml'))"` prints the exact YAML parse error with line and column

## Code examples

### A frequent mistake and its fix

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: "Build: release"        # quote values that contain ': '
        run: echo "ok"
      - uses: actions/checkout@v4     # 2-space indent, no tabs
```

## How to diagnose

1. **Line** — Which line does the banner point at?
2. **Whitespace** — Tabs or mixed indentation?
3. **Lint** — Does actionlint report more?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-invalid-workflow-file)
