com.atlassian.stash.pull.IllegalPullRequestStateException: This pull request has already been merged.

Atlassian JIRA | Matthew Trisoline | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When using Stash v3.0.4 there is an issue when merging a pull request. When a new pull request is created and merged it merges the code successfully but returns a 409 stating that the pull request has already been merged. Its almost like its submitting a double post. But issuing a git fetch & pull or browsing the code inside of Stash shows that it was successfully merged. When running with the Chome debugger we get a response of invalid JSON I have been able to replicate this in Chrome, Firefox, Chromium, IE 10 {All Latest Versions} {noformat} GET https://stash.example.com/rest/api/latest/projects/STAS/repos/stash-test/pull-requests/11/merge 409 (Conflict) batch.js:169 send batch.js:169 c.extend.ajax batch.js:163 P batch.js:1859 C batch.js:1859 A batch.js:1861 N batch.js:3717 h batch.js:3717 d.onReady batch.js:3717 (anonymous function) overview:31 JQMIGRATE: jQuery.parseJSON requires a valid JSON string {noformat} {noformat} ==> atlassian-stash.log <== 2014-07-02 10:04:13,170 DEBUG [http-bio-127.0.0.1-7990-exec-222] matt.trisoline 604x47765x0 5n0dne X.X.X.X,127.0.0.1 "GET /rest/api/latest/projects/STAS/repos/stash-test/pull-requests/10/merge HTTP/1.1" c.a.s.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 409 com.atlassian.stash.pull.IllegalPullRequestStateException: This pull request has already been merged. at com.atlassian.stash.internal.pull.PullRequestServiceImpl.checkIsOpen(PullRequestServiceImpl.java:1010) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:972) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:284) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.rest.pull.PullRequestResource.canMerge(PullRequestResource.java:376) ~[stash-rest-3.0.4.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) [applinks-plugin-4.1.3_1397479846000.jar:na] at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:93) [StashAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) [atlassian-trusted-apps-core-3.0.5.jar:na] at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) [atlassian-oauth-service-provider-plugin-1.9.2_1396905272000.jar:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:70) [stash-service-impl-3.0.4.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_05] at java.lang.Thread.run(Unknown Source) [na:1.7.0_05] ... 230 frames trimmed {noformat}

    Atlassian JIRA | 3 years ago | Matthew Trisoline
    com.atlassian.stash.pull.IllegalPullRequestStateException: This pull request has already been merged.
  2. 0

    When using Stash v3.0.4 there is an issue when merging a pull request. When a new pull request is created and merged it merges the code successfully but returns a 409 stating that the pull request has already been merged. Its almost like its submitting a double post. But issuing a git fetch & pull or browsing the code inside of Stash shows that it was successfully merged. When running with the Chome debugger we get a response of invalid JSON I have been able to replicate this in Chrome, Firefox, Chromium, IE 10 {All Latest Versions} {noformat} GET https://stash.example.com/rest/api/latest/projects/STAS/repos/stash-test/pull-requests/11/merge 409 (Conflict) batch.js:169 send batch.js:169 c.extend.ajax batch.js:163 P batch.js:1859 C batch.js:1859 A batch.js:1861 N batch.js:3717 h batch.js:3717 d.onReady batch.js:3717 (anonymous function) overview:31 JQMIGRATE: jQuery.parseJSON requires a valid JSON string {noformat} {noformat} ==> atlassian-stash.log <== 2014-07-02 10:04:13,170 DEBUG [http-bio-127.0.0.1-7990-exec-222] matt.trisoline 604x47765x0 5n0dne X.X.X.X,127.0.0.1 "GET /rest/api/latest/projects/STAS/repos/stash-test/pull-requests/10/merge HTTP/1.1" c.a.s.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 409 com.atlassian.stash.pull.IllegalPullRequestStateException: This pull request has already been merged. at com.atlassian.stash.internal.pull.PullRequestServiceImpl.checkIsOpen(PullRequestServiceImpl.java:1010) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:972) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:284) ~[stash-service-impl-3.0.4.jar:na] at com.atlassian.stash.internal.rest.pull.PullRequestResource.canMerge(PullRequestResource.java:376) ~[stash-rest-3.0.4.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) [applinks-plugin-4.1.3_1397479846000.jar:na] at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:93) [StashAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) [atlassian-trusted-apps-core-3.0.5.jar:na] at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) [atlassian-oauth-service-provider-plugin-1.9.2_1396905272000.jar:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [BeforeLoginPluginAuthenticationFilter.class:na] at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:70) [stash-service-impl-3.0.4.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_05] at java.lang.Thread.run(Unknown Source) [na:1.7.0_05] ... 230 frames trimmed {noformat}

    Atlassian JIRA | 3 years ago | Matthew Trisoline
    com.atlassian.stash.pull.IllegalPullRequestStateException: This pull request has already been merged.

    Root Cause Analysis

    1. com.atlassian.stash.pull.IllegalPullRequestStateException

      This pull request has already been merged.

      at com.atlassian.stash.internal.pull.PullRequestServiceImpl.checkIsOpen()
    2. com.atlassian.stash
      PullRequestResource.canMerge
      1. com.atlassian.stash.internal.pull.PullRequestServiceImpl.checkIsOpen(PullRequestServiceImpl.java:1010)[stash-service-impl-3.0.4.jar:na]
      2. com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:972)[stash-service-impl-3.0.4.jar:na]
      3. com.atlassian.stash.internal.pull.PullRequestServiceImpl.canMerge(PullRequestServiceImpl.java:284)[stash-service-impl-3.0.4.jar:na]
      4. com.atlassian.stash.internal.rest.pull.PullRequestResource.canMerge(PullRequestResource.java:376)[stash-rest-3.0.4.jar:na]
      4 frames
    3. com.atlassian.applinks
      ContextFilter.doFilter
      1. com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25)[applinks-plugin-4.1.3_1397479846000.jar:na]
      1 frame
    4. com.atlassian.stash
      BeforeLoginPluginAuthenticationFilter.doFilter
      1. com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:93)[StashAuthenticationFilter.class:na]
      2. com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111)[BeforeLoginPluginAuthenticationFilter.class:na]
      3. com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77)[BeforeLoginPluginAuthenticationFilter.class:na]
      3 frames
    5. com.atlassian.security
      TrustedApplicationsFilter.doFilter
      1. com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100)[atlassian-trusted-apps-core-3.0.5.jar:na]
      1 frame
    6. com.atlassian.oauth
      OAuthFilter.doFilter
      1. com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69)[atlassian-oauth-service-provider-plugin-1.9.2_1396905272000.jar:na]
      1 frame
    7. com.atlassian.stash
      DefaultRequestManager.doAsRequest
      1. com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89)[BeforeLoginPluginAuthenticationFilter.class:na]
      2. com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)[BeforeLoginPluginAuthenticationFilter.class:na]
      3. com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:70)[stash-service-impl-3.0.4.jar:na]
      3 frames
    8. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[na:1.7.0_05]
      2. java.lang.Thread.run(Unknown Source)[na:1.7.0_05]
      2 frames