René's URL Explorer Experiment


Title: Error when triggering a pipeline for a merge request: "The resulting pipeline would have been empty" · python-gitlab/python-gitlab · Discussion #3076 · GitHub

Open Graph Title: Error when triggering a pipeline for a merge request: "The resulting pipeline would have been empty" · python-gitlab/python-gitlab · Discussion #3076

X Title: Error when triggering a pipeline for a merge request: "The resulting pipeline would have been empty" · python-gitlab/python-gitlab · Discussion #3076

Description: Error when triggering a pipeline for a merge request: "The resulting pipeline would have been empty"

Open Graph Description: Description of the problem, including code/CLI snippet I’m trying to trigger a pipeline for a merge request using the python-gitlab package, but I’m encountering a 400 error with the message: "The ...

X Description: Description of the problem, including code/CLI snippet I’m trying to trigger a pipeline for a merge request using the python-gitlab package, but I’m encountering a 400 error with the message: "...

Opengraph URL: https://github.com/python-gitlab/python-gitlab/discussions/3076

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Error when triggering a pipeline for a merge request: \"The resulting pipeline would have been empty\"","text":"

Description of the problem, including code/CLI snippet

\n

I’m trying to trigger a pipeline for a merge request using the python-gitlab package, but I’m encountering a 400 error with the message: \"The resulting pipeline would have been empty.\" My GitLab CI configuration does not include any rules for the job, so I’m unsure why this error is occurring.

\n

Here’s the code I’m using:

\n
import gitlab\nfrom .constants import URL, TOKEN, PROJECT_ID, MR_ID\n\ngl = gitlab.Gitlab(url=URL, private_token=TOKEN)\n\nresponse = gl.http_request(\n    \"POST\",\n    f\"/projects/{PROJECT_ID}/merge_requests/{MR_ID}/pipelines\",\n    timeout=60,\n    retry_transient_errors=True,\n)\n\nprint(response)\n
\n

And here’s my .gitlab-ci.yml configuration:

\n
pre-commit:\n  image: python:3.12-bookworm\n\n  before_script:\n    - apt update\n    - apt install -y --no-install-recommends pipx\n    - PATH=\"/root/.local/bin:$PATH\"\n    - pipx install pre-commit\n\n  script:\n    - pre-commit run --all-files\n
\n

Expected Behavior

\n

The pipeline should be triggered successfully, and the pre-commit job defined in the .gitlab-ci.yml file should run.

\n

Actual Behavior

\n

The pipeline fails to trigger, and I receive the following error:

\n
Traceback (most recent call last):\n  File \"/Users/neXeacon/Desktop/marge-bot/test.py\", line 7, in <module>\n    response = gl.http_request(\n        \"POST\",\n        f\"/projects/{PROJECT_ID}/merge_requests/{MR_ID}/pipelines\",\n        timeout=60,\n        retry_transient_errors=True,\n    )\n  File \"/Users/neXeacon/Desktop/marge-bot/venv/lib/python3.13/site-packages/gitlab/client.py\", line 773, in http_request\n    raise gitlab.exceptions.GitlabHttpError(\ngitlab.exceptions.GitlabHttpError: 400: {'base': ['The resulting pipeline would have been empty. Review the rules configuration for the relevant jobs.']}\n
\n

Specifications

\n","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

This doesn't sound like a python-gitlab issue to me.

\n

Please look at: https://docs.gitlab.com/ee/api/merge_requests.html#create-merge-request-pipeline

\n

From the first part of the docs there it says:

\n
\n

Create a new pipeline for a merge request. A pipeline created from this endpoint doesn’t run a regular branch/tag pipeline. To create jobs, configure .gitlab-ci.yml with only: [merge_requests].

\n
\n

Also look at https://docs.gitlab.com/ee/ci/yaml/ and search for merge_requests. Looks like it is required to have in the .gitlab-ci.yml a only: merge_requests in your config.

\n

Any reason to not use: https://python-gitlab.readthedocs.io/en/stable/gl_objects/merge_requests.html#merge-request-pipelines ?

","upvoteCount":1,"url":"https://github.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:37b63ae7-25a6-9b4d-7af5-6586e4c581ff
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idA248:1BF5D2:39C46BF:4B2CA74:697509F9
html-safe-nonceda161ef54b8d9c7cba630bd9c18ec987e6ea31a5892d7fb80df8ba9344ffc479
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjQ4OjFCRjVEMjozOUM0NkJGOjRCMkNBNzQ6Njk3NTA5RjkiLCJ2aXNpdG9yX2lkIjoiNjIzNzIwOTU2NDA5MzQxNzk3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac383a6ba5f27d61b33d7a33b7335ce001c713a16d1e6186b192fe9bfd6c969c92
hovercard-subject-tagdiscussion:7771974
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-gitlab/python-gitlab/3076/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/c8a9ff7cebc6da3ea500c5f304793519a5510ed44ec241537246edeeedcf59da/python-gitlab/python-gitlab/discussions/3076
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c8a9ff7cebc6da3ea500c5f304793519a5510ed44ec241537246edeeedcf59da/python-gitlab/python-gitlab/discussions/3076
og:image:altDescription of the problem, including code/CLI snippet I’m trying to trigger a pipeline for a merge request using the python-gitlab package, but I’m encountering a 400 error with the message: "The ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f
turbo-cache-controlno-preview
go-importgithub.com/python-gitlab/python-gitlab git https://github.com/python-gitlab/python-gitlab.git
octolytics-dimension-user_id28886265
octolytics-dimension-user_loginpython-gitlab
octolytics-dimension-repository_id8077625
octolytics-dimension-repository_nwopython-gitlab/python-gitlab
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id8077625
octolytics-dimension-repository_network_root_nwopython-gitlab/python-gitlab
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release488b30e96dfd057fbbe44c6665ccbc030b729dde
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F3076
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F3076
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=python-gitlab%2Fpython-gitlab
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
python-gitlab https://patch-diff.githubusercontent.com/python-gitlab
python-gitlabhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Fork 675 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Star 2.4k https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Code https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Issues 26 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues
Pull requests 11 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulls
Discussions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions
Actions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/actions
Projects 0 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/projects
Security 0 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/security
Insights https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulse
Code https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Issues https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues
Pull requests https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulls
Discussions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions
Actions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/actions
Projects https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/projects
Security https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/security
Insights https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulse
Answered https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234
JohnVillalovoshttps://patch-diff.githubusercontent.com/JohnVillalovos
hailatGH https://patch-diff.githubusercontent.com/hailatGH
Q&Ahttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/categories/q-a
Error when triggering a pipeline for a merge request: "The resulting pipeline would have been empty" https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#top
hailatGH https://patch-diff.githubusercontent.com/hailatGH
Answered https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234
JohnVillalovoshttps://patch-diff.githubusercontent.com/JohnVillalovos
Return to tophttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#top
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
hailatGH https://patch-diff.githubusercontent.com/hailatGH
Jan 2, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussion-7771974
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
JohnVillalovos https://patch-diff.githubusercontent.com/JohnVillalovos
Jan 2, 2025 https://github.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234
https://docs.gitlab.com/ee/api/merge_requests.html#create-merge-request-pipelinehttps://docs.gitlab.com/ee/api/merge_requests.html#create-merge-request-pipeline
pipeline for a merge requesthttps://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html
https://docs.gitlab.com/ee/ci/yaml/https://docs.gitlab.com/ee/ci/yaml/
https://python-gitlab.readthedocs.io/en/stable/gl_objects/merge_requests.html#merge-request-pipelineshttps://python-gitlab.readthedocs.io/en/stable/gl_objects/merge_requests.html#merge-request-pipelines
View full answer https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234
Oldest https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076?sort=old
Newest https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076?sort=new
Top https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
JohnVillalovos https://patch-diff.githubusercontent.com/JohnVillalovos
Jan 2, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719234
https://docs.gitlab.com/ee/api/merge_requests.html#create-merge-request-pipelinehttps://docs.gitlab.com/ee/api/merge_requests.html#create-merge-request-pipeline
pipeline for a merge requesthttps://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html
https://docs.gitlab.com/ee/ci/yaml/https://docs.gitlab.com/ee/ci/yaml/
https://python-gitlab.readthedocs.io/en/stable/gl_objects/merge_requests.html#merge-request-pipelineshttps://python-gitlab.readthedocs.io/en/stable/gl_objects/merge_requests.html#merge-request-pipelines
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/JohnVillalovos
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
JohnVillalovoshttps://patch-diff.githubusercontent.com/JohnVillalovos
Jan 2, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11719732
@hailatGHhttps://github.com/hailatGH
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/hailatGH
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
hailatGHhttps://patch-diff.githubusercontent.com/hailatGH
Jan 3, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11723311
@JohnVillalovoshttps://github.com/JohnVillalovos
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/JohnVillalovos
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
JohnVillalovoshttps://patch-diff.githubusercontent.com/JohnVillalovos
Jan 3, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-11723413
@JohnVillalovoshttps://github.com/JohnVillalovos
@hailatGHhttps://github.com/hailatGH
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
JohnVillalovoshttps://patch-diff.githubusercontent.com/JohnVillalovos
Please reload this pagehttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
AnMokoto https://patch-diff.githubusercontent.com/AnMokoto
Apr 23, 2025 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076#discussioncomment-12922981
https://docs.gitlab.com/ci/pipelines/downstream_pipelines_troubleshooting/#job-in-child-pipeline-is-not-created-when-the-pipeline-runshttps://docs.gitlab.com/ci/pipelines/downstream_pipelines_troubleshooting/#job-in-child-pipeline-is-not-created-when-the-pipeline-runs
Give feedback.https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F3076
🙏 Q&A https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/categories/q-a
https://patch-diff.githubusercontent.com/hailatGH
https://patch-diff.githubusercontent.com/JohnVillalovos
https://patch-diff.githubusercontent.com/AnMokoto
#3075https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3075
https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions/3076
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.