Bitbucket Pipelines: "Currently no online runner available that matches the required labels."
A step with runs-on fails at once with this message. For such a step, Pipelines looks for a self-hosted runner that is online, belongs to this repository or to its workspace, and has every label the step lists. When the matching runners are only busy, the step waits; when there is none, it fails (Atlassian's Configure your runner in bitbucket-pipelines.yml). So one of these is off: the labels, the runner's state, or where the runner was added.
1. One runner must have every label
When you add a runner, Bitbucket gives it self.hosted and a label for its platform; the custom labels are the ones you typed (Atlassian's article Currently no online runner available that matches the required labels, and Adding a new runner):
- Linux shell:
self.hosted,linux.shell - Linux Docker:
self.hosted,linux(ARM:linux.arm64) - Windows:
self.hosted,windows - macOS:
self.hosted,macos
The step's runs-on must include self.hosted. Without a platform label, Pipelines takes the step for a Linux Docker step: a step meant for a Linux shell runner that leaves out linux.shell looks for a Docker runner and finds none. Every label has to be on the same runner; two runners with half of them each do not count.
- step:
runs-on:
- self.hosted
- linux.shell
- build.fast
script:
- ./build.sh
Compare the list with the labels on the runner's row on the Runners page. Labels can only contain lowercase letters, digits and dots, and a runner can have up to 10 custom ones.
2. The runner must be online
The Runners page shows each runner's state. A runner you added but never started stays Unregistered; Atlassian asks you to run the command it showed when you added the runner and wait for Online. Bitbucket shows that command only once, so keep it: it is also how you start the runner again after the machine or its service stopped. A runner that went Unhealthy because it could not clean up after a step needs that fixed first ("We couldn't clone the repository" has the cases).
3. It must belong to this repository or its workspace
A repository runner, added under the repository's Settings, Pipelines, Runners, serves only that repository. A workspace runner, under Workspace settings, Pipelines, Workspace runners, serves every repository of that workspace. In a community thread where the runner was online with the right labels, those were the two questions Atlassian's engineer asked: was the workspace runner made in the workspace in the repository's address (bitbucket.org/<workspace>/<repository>), and was the repository runner made for this repository rather than another one.
A label from a variable
A label written as $runner is rejected before the step starts: Only alphanumeric characters and dots can be used in runs-on labels. (BCLOUD-21510). Atlassian closed that request, pointing to YAML templating, ${{ NAME }}, for workspace and repository variables that are not secured (Variables and secrets). Its page does not name runs-on, and we have not tried it there.
A step that fails this way did not run on Atlassian's machines. In another thread, Atlassian's engineer notes that such a build fails without using the workspace's build minutes.
See which step failed 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 their steps. For a failed pipeline it shows why: Bitbucket's own reason when Bitbucket ended the step, or else the failed command and its last lines. It opens bitbucket-pipelines.yml in the editor when the project has it, for the runs-on lines. If you fixed the runner rather than the file, there is no new commit to push: with Pro, Run again builds the same commit once more from the IDE. The list, steps and logs are free; running, re-running and stopping pipelines 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; Docker is a trademark of Docker, Inc.; Windows is a trademark of the Microsoft group of companies; macOS is a trademark of Apple Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by any of them.
More: "We couldn't clone the repository" · Submodules not cloned · "command not found" · "unexpected system error" · The cache is not used · Pipelines did not run after a push · "Exceeded build time limit of 120 minutes" · "Container 'Build' exceeded memory limit." · "Container 'docker' exceeded memory limit." · "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 · 日本語