theonedev/onedev · error · ExplicitException

No common base for target and source branches

Error message

No common base for target and source branches

What it means

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).

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspec/step/CreatePullRequestStep.java:149

				logger.warning("Pull request will not be created as target branch is the same as source branch");
			} else {
				var pullRequestService = OneDev.getInstance(PullRequestService.class);
				var pullRequest = pullRequestService.findOpen(target, source);
				if (pullRequest != null) {
					logger.warning("A pull request has already been opened for specified branches");
				} else {
					pullRequest = new PullRequest();
					pullRequest.setTarget(target);
					pullRequest.setSource(source);
					pullRequest.setMergeStrategy(getMergeStrategy());
					pullRequest.setSubmitter(OneDev.getInstance(UserService.class).getSystem());
	
					var baseCommitId = OneDev.getInstance(GitService.class).getMergeBase(
						target.getProject(), target.getObjectId(), 
						source.getProject(), source.getObjectId());
	
					if (baseCommitId == null)
						throw new ExplicitException("No common base for target and source branches");
	
					if (baseCommitId.name().equals(source.getObjectName())) {
						logger.warning("Pull request will not be created as target branch is already up to date with source branch");
					} else {
						pullRequest.setBaseCommitHash(baseCommitId.name());
	
						var update = new PullRequestUpdate();
						pullRequest.getUpdates().add(update);
						pullRequest.setUpdates(pullRequest.getUpdates());
						update.setRequest(pullRequest);
						update.setHeadCommitHash(source.getObjectName());
						update.setTargetHeadCommitHash(pullRequest.getTarget().getObjectName());						
							
						var titleAndDescription = titleAndDescritpionProvider.getTitleAndDescription(pullRequest);
						
						pullRequest.setTitle(titleAndDescription.getLeft());
						if (isWorkInProgress() && !pullRequest.isWorkInProgress()) 
							pullRequest.setTitle("[WIP] " + pullRequest.getTitle());

View on GitHub (pinned to d44925c47c)

Solutions

  1. Verify the source branch was branched from the target's history.
  2. Use a source branch that shares history with the target branch.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/buildspec/step/CreatePullRequestStep.java:149 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/9d7c6c97ab003073. Report an issue: GitHub.