theonedev/onedev · error · NotAcceptableException
Source branch is required
Error message
Source branch is required
What it means
Input validation in createPullRequest (TodResource): the request omitted the source project and/or source branch, but a pull request needs an explicit source to merge from; the endpoint throws a NotAcceptable/validation error before resolving branches. Fix: supply sourceProject (and source branch) parameters.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:1114
} else {
return project.findDefaultPullRequestMergeStrategy();
}
}
@Path("/create-pull-request")
@POST
public Map<String, Object> createPullRequest(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("targetProject") String targetProjectPath,
@QueryParam("sourceProject") String sourceProjectPath,
@NotNull Map<String, Serializable> data) {
normalizePullRequestData(data);
var targetBranch = (String) data.remove("targetBranch");
var sourceBranch = (String) data.remove("sourceBranch");
if (sourceBranch == null)
throw new NotAcceptableException("Source branch is required");
var createPullRequestEssentialInfo = getCreatePullRequestEssentialInfo(
currentProjectPath, targetProjectPath, sourceProjectPath,
targetBranch, sourceBranch);
var currentProject = createPullRequestEssentialInfo.currentProject;
var target = createPullRequestEssentialInfo.target;
var source = createPullRequestEssentialInfo.source;
var submitter = createPullRequestEssentialInfo.submitter;
var mergeStrategyName = (String) data.remove("mergeStrategy");
var mergeStrategy = getMergeStrategy(target.getProject(), mergeStrategyName);
var request = pullRequestService.findOpen(target, source);
if (request != null)
return PullRequestHelper.getDetail(currentProject, request);
request = new PullRequest();View on GitHub (pinned to d44925c47c)
Solutions
- Provide the sourceBranch field in the request data.
- Verify the branch name exists in the source project before creating the PR.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:1114 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/db39dbcacd420295.
Report an issue: GitHub.