Bitbucket Pipelines: "Exceeded build time limit of 120 minutes"
The step ran longer than its maximum time, so Bitbucket stopped it. The maximum is 120 minutes unless max-time sets another number, and the message then shows that number instead of 120. Usually one command is waiting for something that never comes. Find it first; raise max-time only for a step that really needs longer.
The limit
From Atlassian's Step options and its article on this message (Bitbucket pipeline is failing with Exceeded build time limit error):
max-timeis in minutes: a whole number from 1 to 720 (12 hours). The default is 120.- Set it under
optionsfor every step, or on one step. The step's own value wins. - The same range applies on Bitbucket Cloud and on self-hosted runners.
options:
max-time: 30
pipelines:
default:
- step:
name: Unit tests
script:
- npm test
- step:
name: Integration tests
max-time: 180
script:
- npm run test:integration
Here every step stops after 30 minutes except the integration tests, which get three hours. A low limit is also useful: a quick step that hangs stops after a few minutes instead of two hours.
Commands that never end by themselves
- A question nobody answers. The step has no keyboard, so a prompt waits until the time limit. Use the tool's non-interactive form:
apt-get install -y, withDEBIAN_FRONTEND=noninteractivefor packages such as tzdata that ask where you are.GIT_TERMINAL_PROMPT=0makes git fail at once instead of waiting for a user name. - A watch mode or a server.
npm start,vite,jest --watchand the like run until someone stops them. In the pipeline, run the build or the test command that exits. Pipelines setsCI=truein every build; Vitest and Create React App's test script read it and run once instead of watching. - A server started for the tests in the foreground: start it in the background (
&), wait until it answers, then run the tests. - Something slow, not stuck: a test that waits on a network address the build cannot reach, a large download without a cache. These finish eventually, or fail with their own message if they have a timeout.
Find the command
Atlassian's article suggests printing the time before and after each command, and running the same commands locally to compare:
script: - date +"%T" - npm ci - date +"%T" - npm test - date +"%T"
To fail fast instead of waiting for the limit, wrap a command that should be quick in timeout: timeout 10m npm test stops it after ten minutes with exit status 124 (GNU coreutils, as in Ubuntu-based images), and the step fails right there, in the log of the command that hung.
"Step exceeded processing limits and has timed out"
A different message after two hours, with a different cause. Atlassian's article (Bitbucket pipeline build fails with error "Step exceeded processing limits") says the names and values of all workspace, repository and deployment variables of the build, put together, must not exceed 120,000 characters. Over that, the build can stay queued or fail after two hours with this message, whatever your commands do.
Where each level's variables are, a script that adds them up for each deployment environment, and what to shorten: "Step exceeded processing limits and has timed out".
Watch and stop pipelines from IntelliJ IDEA
Pipeline Inbox for Bitbucket Pipelines, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pipelines of all your Bitbucket Cloud repositories in an IDE tool window, with each step's commands and duration. A running step's log grows in the IDE as Bitbucket writes it, so you see which command is still going. With Pro you can stop a running pipeline from the IDE instead of waiting for the limit, and run it again. The list, steps and logs are free; running, re-running and stopping are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
Atlassian, Bitbucket and Bitbucket Pipelines are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: Pipelines did not run after a push · "Container 'Build' exceeded memory limit." · "Container 'docker' exceeded memory limit." · The cache is not used · "unexpected system error" · "command not found" · Submodules not cloned · "We couldn't clone the repository" · "No online runner available" · "No space left on device" · "Step exceeded processing limits" · The artifact is missing in the next step · The build passed before and fails now · Build setup takes too long · "You've run out of build minutes" · "Permission denied to update branch" · "You have reached your pull rate limit" (Docker Hub) · "There is an error in your bitbucket-pipelines.yml" · "This pipeline was paused" (deployments) · Bitbucket Pipelines plugins for IntelliJ IDEA, compared · 日本語