Lesstep
Bitbucket Cloud · Pipelines · Checked October 31, 2026

Bitbucket Pipelines: run a custom pipeline with variables

A pipeline under custom: in bitbucket-pipelines.yml never runs on a push. You start it by hand, on a schedule, or from a script through the REST API, and it can ask for variables each time. From a script, the most common answer is HTTP 400 "bitbucket-pipelines.yml not found.", even though the file is there. Every public report of it below came down to the selector in the request.

Declare the variables

From Atlassian's pipeline start conditions: a custom pipeline may start with a variables list, and each variable has a name (required), and optionally a default, allowed-values and a description.

pipelines:
  custom:
    deploy-staging:            # the pipeline's name
      - variables:
          - name: VERSION
            description: "Tag or commit to deploy"
          - name: REGION
            default: "eu-west-1"
            allowed-values:
              - "eu-west-1"
              - "us-east-1"
      - step:
          script:
            - ./deploy.sh "$VERSION" "$REGION"

Run it on Bitbucket

From Atlassian's scheduled and manually triggered pipelines: open the repository's Pipelines page and choose Run pipeline. Pick the branch or tag, then the pipeline, fill in the variables, and choose Run. The Branches and Commits pages have Run pipeline in a branch's or commit's … menu too. Running a pipeline needs write access to the repository.

Run it with the REST API

Bitbucket's Pipelines API, Run a pipeline:

curl -X POST -u '<email>:<API token>' \
  -H 'Content-Type: application/json' \
  https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPO/pipelines/ \
  -d '{
    "target": {
      "type": "pipeline_ref_target",
      "ref_type": "branch",
      "ref_name": "main",
      "selector": { "type": "custom", "pattern": "deploy-staging" }
    },
    "variables": [
      { "key": "VERSION", "value": "v2.4.1" },
      { "key": "REGION", "value": "us-east-1" }
    ]
  }'

"bitbucket-pipelines.yml not found."

HTTP 400
{"error": {"message": "Bad request", "detail": "bitbucket-pipelines.yml not found.",
  "data": {"key": "result-service.pipeline.yml-not-found", "arguments": {}}}}

Bitbucket's API reference lists three reasons for a 400 here: Pipelines is not enabled for the account or repository, the file is not in the repository at that revision, or the body has an invalid property. In four public threads in Atlassian's community the file was there, Run pipeline on Bitbucket worked, and the request was the problem:

So check, in this order: the target has a selector of type custom; its pattern is the key under custom:, letter for letter; and that key is in bitbucket-pipelines.yml on the branch in ref_name.

Run custom 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. Its Run Pipeline… reads bitbucket-pipelines.yml on the branch you choose and offers that branch's own pipeline and each custom pipeline in it, so the name sent is always one the file has. Each declared variable gets a field, a choice when it lists allowed-values, with the default filled in, and the values can be remembered (never a secured one). When Bitbucket still refuses, the IDE shows Bitbucket's own words. 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 · Out of build minutes · "No online runner available" · "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 · 日本語