theonedev/onedev · error · NotAcceptableException

No common base for source and target branches

Error message

No common base for source and target branches

What it means

During pull request creation, git merge-base between the target and source branch heads returned null, meaning the branches share no common ancestor commit; a mergeable pull request cannot be computed.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:1144

        var mergeStrategy = getMergeStrategy(target.getProject(), mergeStrategyName);

        var request = pullRequestService.findOpen(target, source);
        if (request != null)
            return PullRequestHelper.getDetail(currentProject, request);        

        request = new PullRequest();
        request.setTarget(target);
        request.setSource(source);
        request.setSubmitter(submitter);
        request.setMergeStrategy(mergeStrategy);

        // Pre-populate baseCommitHash + initial update so title/description can
        // be generated from commits below; openNew(...) will keep them as-is.
        ObjectId baseCommitId = gitService.getMergeBase(
                target.getProject(), target.getObjectId(),
                source.getProject(), source.getObjectId());
        if (baseCommitId == null)
            throw new NotAcceptableException("No common base for source and target branches");
        request.setBaseCommitHash(baseCommitId.name());

        PullRequestUpdate update = new PullRequestUpdate();
        update.setRequest(request);
        update.setHeadCommitHash(source.getObjectName());
        update.setTargetHeadCommitHash(target.getObjectName());
        request.getUpdates().add(update);

        var title = (String) data.remove("title");
        if (title == null)
            throw new NotAcceptableException("Title is required");

        request.setTitle(title);

        var description = (String) data.remove("description");
        if (description != null)
            request.setDescription(description);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Ensure the source branch was created from the target repository history (or a branch sharing history with target).
  2. Push a proper source branch instead of an unrelated/orphan one.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:1144 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/1d0baa30224db77b. Report an issue: GitHub.