{"record":{"id":"9d7c6c97ab003073","repo":"theonedev/onedev","slug":"no-common-base-for-target-and-source-branches","errorCode":null,"errorMessage":"No common base for target and source branches","messagePattern":"No common base for target and source branches","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/step/CreatePullRequestStep.java","lineNumber":149,"sourceCode":"\t\t\t\tlogger.warning(\"Pull request will not be created as target branch is the same as source branch\");\n\t\t\t} else {\n\t\t\t\tvar pullRequestService = OneDev.getInstance(PullRequestService.class);\n\t\t\t\tvar pullRequest = pullRequestService.findOpen(target, source);\n\t\t\t\tif (pullRequest != null) {\n\t\t\t\t\tlogger.warning(\"A pull request has already been opened for specified branches\");\n\t\t\t\t} else {\n\t\t\t\t\tpullRequest = new PullRequest();\n\t\t\t\t\tpullRequest.setTarget(target);\n\t\t\t\t\tpullRequest.setSource(source);\n\t\t\t\t\tpullRequest.setMergeStrategy(getMergeStrategy());\n\t\t\t\t\tpullRequest.setSubmitter(OneDev.getInstance(UserService.class).getSystem());\n\t\n\t\t\t\t\tvar baseCommitId = OneDev.getInstance(GitService.class).getMergeBase(\n\t\t\t\t\t\ttarget.getProject(), target.getObjectId(), \n\t\t\t\t\t\tsource.getProject(), source.getObjectId());\n\t\n\t\t\t\t\tif (baseCommitId == null)\n\t\t\t\t\t\tthrow new ExplicitException(\"No common base for target and source branches\");\n\t\n\t\t\t\t\tif (baseCommitId.name().equals(source.getObjectName())) {\n\t\t\t\t\t\tlogger.warning(\"Pull request will not be created as target branch is already up to date with source branch\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpullRequest.setBaseCommitHash(baseCommitId.name());\n\t\n\t\t\t\t\t\tvar update = new PullRequestUpdate();\n\t\t\t\t\t\tpullRequest.getUpdates().add(update);\n\t\t\t\t\t\tpullRequest.setUpdates(pullRequest.getUpdates());\n\t\t\t\t\t\tupdate.setRequest(pullRequest);\n\t\t\t\t\t\tupdate.setHeadCommitHash(source.getObjectName());\n\t\t\t\t\t\tupdate.setTargetHeadCommitHash(pullRequest.getTarget().getObjectName());\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tvar titleAndDescription = titleAndDescritpionProvider.getTitleAndDescription(pullRequest);\n\t\t\t\t\t\t\n\t\t\t\t\t\tpullRequest.setTitle(titleAndDescription.getLeft());\n\t\t\t\t\t\tif (isWorkInProgress() && !pullRequest.isWorkInProgress()) \n\t\t\t\t\t\t\tpullRequest.setTitle(\"[WIP] \" + pullRequest.getTitle());","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/step/CreatePullRequestStep.java#L131-L167","documentation":"Guard in CreatePullRequestStep.run: gitService.getMergeBase found no common ancestor commit between the configured target and source branches, so a merge-based pull request is impossible and ExplicitException aborts the step. Fix: ensure the source branch is derived from the target's history (rebase or correct the branch refs).","triggerScenarios":"Thrown at server-core/src/main/java/io/onedev/server/buildspec/step/CreatePullRequestStep.java:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the source branch was branched from the target's history.","Use a source branch that shares history with the target branch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}