Skip to content
Latchkey

GitHub Actions two jobs with the same id

Two jobs declared under the same id collide. YAML duplicate keys mean the second silently overrides the first or the file is rejected.

What this error means

The workflow is rejected for a duplicate key, or one job mysteriously disappears because its id was reused.

github-actions
Invalid workflow file: .github/workflows/ci.yml#L15
duplicate key 'build' in mapping

Common causes

Copy-pasted job not renamed

Duplicating a job block and forgetting to change its id reuses the key.

Merge brought in a same-named job

A merge can introduce a second job with an existing id.

How to fix it

Give each job a unique id

  1. Rename the duplicate to a distinct id.
  2. Update any needs references to the new id.
.github/workflows/ci.yml
jobs:
  build-linux: { runs-on: ubuntu-latest, steps: [{ run: make }] }
  build-mac:   { runs-on: macos-latest,  steps: [{ run: make }] }

How to prevent it

  • Run a YAML linter that flags duplicate keys.
  • Use descriptive, unique job ids.

Frequently asked questions

What causes "two jobs with the same id"?
Duplicating a job block and forgetting to change its id reuses the key.
How do I fix two jobs with the same id?
Give each job a unique id

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card