com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}}

Jenkins JIRA | Ryan Rupp | 3 months ago
  1. 0

    This is essentially the same issue as JENKINS-32781, occurs when using the latest version of the plugin built off master (testing out new build status notifications). Bitbucket requires the key to be <= 40 characters but it looks like right now the job name is being used which for my case with pipelines would be the branch name which is typically fairly long because we're using auto generated branch names from Jira (uses jira number + title). Also, I'm not sure what the desired uniqueness is here but in JENKINS-32781 the key is the project name + build number so each build can have a unique status e.g. built once and tests were flakey and it failed but then built again and it passed - depends if you want the build status to record both runs or just the latest one. The diff from JENKINS-32781 for reference - https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/commit/d73ec91ad424e4f885a7961579a55ccf1299d5e2 Callstack for reference on failed builds (created a long branch name to test this): {code} [Bitbucket] Notifying commit build result com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}} at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:486) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:513) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postBuildStatus(BitbucketCloudApiClient.java:303) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:49) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createBuildCommitStatus(BitbucketBuildStatusNotifications.java:85) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:171) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$000(BitbucketBuildStatusNotifications.java:60) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout(BitbucketBuildStatusNotifications.java:190) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:123) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:207) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE {code}

    Jenkins JIRA | 3 months ago | Ryan Rupp
    com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}}
  2. 0

    [JIRA] (JENKINS-36874) Pull request not built when build status patch is applied

    Google Groups | 5 months ago | pavly...@yandex.by (JIRA)
    com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {<span class="code-quote" style="color: #009100">"error"</span>: {<span class="code-quote" style="color: #009100">"fields"</span>: {<span class="code-quote" style="color: #009100">"key"</span>: [<span class="code-quote" style="color: #009100">"Ensure <span class="code-keyword" style="color: #000091; color: #009100">this</span> value has at most 40 characters (it has 54)."</span>]}, <span class="code-quote" style="color: #009100">"message"</span>: <span class="code-quote" style="color: #009100">"Bad request"</span>}}
  3. 0

    When user send pull request {code:java} [Bitbucket] Notifying commit build result com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 54)."]}, "message": "Bad request"}} at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:486) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:513) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postBuildStatus(BitbucketCloudApiClient.java:303) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:49) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createBuildCommitStatus(BitbucketBuildStatusNotifications.java:85) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:171) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$000(BitbucketBuildStatusNotifications.java:60) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout(BitbucketBuildStatusNotifications.java:190) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:123) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:206) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) Finished: FAILURE {code} PR link: [https://bitbucket.org/XVM/xvm/pull-requests/288/battlelabels-descripton-typo/] Full Log: [http://ci.modxvm.com/job/XVM/job/demon2597%252Fbattlelabels-descripton-typo-1469180738999/1/console]

    Jenkins JIRA | 5 months ago | Mikhail Paulyshka
    com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 54)."]}, "message": "Bad request"}}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [JIRA] (JENKINS-38664) bitbucket source plugin fails with bad URL

    Google Groups | 2 months ago | james....@gmail.com (JIRA)
    com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST. {<span class="code-quote" style="color: #009100">"error"</span>: {<span class="code-quote" style="color: #009100">"fields"</span>: {<span class="code-quote" style="color: #009100">"url"</span>: [<span class="code-quote" style="color: #009100">"Enter a valid URL."</span>]}, <span class="code-quote" style="color: #009100">"message"</span>: <span class="code-quote" style="color: #009100">"Bad request"</span>}}
  6. 0

    [JIRA] (JENKINS-38146) The generated key for notifications can be more than the 40 character limit which fails

    Google Groups | 3 months ago | ryan....@gmail.com (JIRA)
    com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST.<br>{"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}}

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException

      HTTP request error. Status: 400: BAD REQUEST. {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}}

      at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest()
    2. com.cloudbees.jenkins
      BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout
      1. com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:486)
      2. com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:513)
      3. com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postBuildStatus(BitbucketCloudApiClient.java:303)
      4. com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:49)
      5. com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createBuildCommitStatus(BitbucketBuildStatusNotifications.java:85)
      6. com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:171)
      7. com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$000(BitbucketBuildStatusNotifications.java:60)
      8. com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout(BitbucketBuildStatusNotifications.java:190)
      8 frames
    3. org.jenkinsci.plugins
      WorkflowRun.run
      1. org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:123)
      2. org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
      3. org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85)
      4. org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:207)
      4 frames
    4. Hudson
      Executor.run
      1. hudson.model.ResourceController.execute(ResourceController.java:98)
      2. hudson.model.Executor.run(Executor.java:410)
      2 frames