Skip to content
Latchkey

Bitbucket "Maximum number of services" Exceeded in a Step

A step listed more service containers than Bitbucket permits. There is a hard cap on how many services one step can attach, regardless of memory.

What this error means

The pipeline fails validation noting the step exceeds the maximum number of services. It is a structural limit, so it fails before the step runs.

Bitbucket UI
Configuration error: step defines 6 services but the maximum
number of services per step is 5.

Common causes

Too many services attached to one step

Bitbucket caps the number of services a single step can run. Listing more than the limit is rejected up front.

Services that could be combined or dropped

Some "services" are only needed by part of the work and could move to a separate step, or be merged (e.g. one database image instead of several).

How to fix it

Split services across steps

Move services to the specific steps that need them so no single step exceeds the cap.

bitbucket-pipelines.yml
- step:
    name: API tests
    services: [ postgres, redis ]
    script: [ ./test-api.sh ]
- step:
    name: Search tests
    services: [ elasticsearch ]
    script: [ ./test-search.sh ]

Remove services the step does not use

  1. Audit which services each step actually connects to.
  2. Drop unused services from that step’s services: list.
  3. Consolidate duplicates where one container can serve multiple needs.

How to prevent it

  • Attach a service only to the steps that use it.
  • Keep service counts per step within Bitbucket’s limit.
  • Prefer fewer, shared services over many narrow ones.

Frequently asked questions

What causes ""Maximum number of ... services""?
Bitbucket caps the number of services a single step can run. Listing more than the limit is rejected up front.
How do I fix "Maximum number of ... services"?
Move services to the specific steps that need them so no single step exceeds the cap.

Related guides

References

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