Skip to content
Latchkey

GitLab CI "may allow multiple pipelines to run for a single action"

When job rules match both a branch push and a merge-request event for the same commit, GitLab can create two pipelines. The Pipeline Editor warns about this so you can add workflow:rules to pick one.

What this error means

Two pipelines appear for a single push to a branch with an open MR, and the editor shows a warning that the configuration may allow multiple pipelines to run for a single action.

gitlab-ci
jobs:test may allow multiple pipelines to run for a single action
due to rules:if clauses with no workflow:rules. This warning might be
two pipelines: a branch pipeline and a merge request pipeline.

Common causes

Rules match both push and MR sources

A rule like if: ${CI_COMMIT_BRANCH} matches branch pushes, and a separate merge_request_event rule matches MRs, so the same commit triggers both.

No top-level workflow:rules gate

Without workflow:rules, GitLab does not deduplicate the branch and MR pipelines for the same ref.

How to fix it

Add workflow:rules to pick one pipeline

Use the standard pattern that skips branch pipelines when an open MR exists.

.gitlab-ci.yml
workflow:
  rules:
    - if: '${CI_PIPELINE_SOURCE} == "merge_request_event"'
    - if: '${CI_COMMIT_BRANCH} && ${CI_OPEN_MERGE_REQUESTS}'
      when: never
    - if: '${CI_COMMIT_BRANCH}'

How to prevent it

  • Always define workflow:rules in projects that use merge-request pipelines.
  • Use the CI_OPEN_MERGE_REQUESTS guard to suppress duplicate branch pipelines.
  • Heed the editor warning before merging rule changes.

Frequently asked questions

What causes ""multiple pipelines" warning"?
A rule like if: ${CI_COMMIT_BRANCH} matches branch pushes, and a separate merge_request_event rule matches MRs, so the same commit triggers both.
How do I fix "multiple pipelines" warning?
Use the standard pattern that skips branch pipelines when an open MR exists.

Related guides

References

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