theonedev/onedev · error · UnauthorizedException
No permission to create branch: %s
Error message
No permission to create branch: %s
What it means
ensureBranch verifies SecurityUtils.canCreateBranch for the suggested branch name in the issue's project and throws UnauthorizedException when the subject lacks permission, naming the branch that would have been created.
Source
Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java:1480
if (normalizedTitle != null) {
normalizedTitle = StringUtils.stripEnd(StringUtils.abbreviate(normalizedTitle, "", MAX_BRANCH_TITLE_LENGTH), "-");
return prefixWithSlash + "issue-" + issue.getNumber() + "-" + normalizedTitle;
} else {
return prefixWithSlash + "issue-" + issue.getNumber();
}
}
@Sessional
@Override
public String ensureBranch(Subject subject, Issue issue) {
if (issue.getBranch() != null)
return issue.getBranch();
Project project = issue.getProject();
String suggestedBranch = suggestBranch(issue);
if (!SecurityUtils.canCreateBranch(project, suggestedBranch))
throw new UnauthorizedException("No permission to create branch: " + suggestedBranch);
if (project.getBranchRef(suggestedBranch) != null) {
throw new NotAcceptableException(MessageFormat.format("Branch \"{0}\" already exists", suggestedBranch));
} else {
RevCommit commit = null;
if (issue.getFieldCommitId() != null)
commit = project.getRevCommit(issue.getFieldCommitId(), false);
if (commit == null) {
String defaultBranch = project.getDefaultBranch();
if (defaultBranch == null)
throw new NotAcceptableException("Default branch is not available");
else
commit = project.getRevCommit(defaultBranch, true);
}
if (!project.isCommitSignatureRequirementSatisfied(SecurityUtils.getUser(subject), suggestedBranch, commit)) {
throw new NotAcceptableException("Valid signature required for head commit of this branch per branch protection rule");
} else {
gitService.createBranch(project, suggestedBranch, commit.name());View on GitHub (pinned to d44925c47c)
Solutions
- Grant the user 'Create Branch' permission (project role/authorization) in the issue's project.
- Operate as a user with code-write rights.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java:1480 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/36803adb08831c18.
Report an issue: GitHub.