theonedev/onedev · warning · BlobEditException
Review required for this change. Please submit pull request
Error message
Review required for this change. Please submit pull request instead
What it means
When saving a blob edit, ProjectBlobPage calls Project.isReviewRequiredForModification; if the branch protection requires review for modifications to that path, a BlobEditException instructs the user to submit a pull request instead of committing directly.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java:1633
}
User user = Preconditions.checkNotNull(SecurityUtils.getAuthUser());
BlobIdent blobIdent = getBlobIdent();
boolean signRequired = false;
for (var item: upload.getItems()) {
String blobPath = FilenameUtils.sanitizeFileName(FileUpload.getFileName(item));
if (parentPath != null)
blobPath = parentPath + "/" + blobPath;
var blobType = FileExtension.getExtension(blobPath);
var disallowedFileTypes = getProject().getBranchProtection(blobIdent.revision, user).getDisallowedFileTypes();
if (disallowedFileTypes.stream().anyMatch(type -> type.equalsIgnoreCase(blobType))) {
throw new BlobEditException(MessageFormat.format(_T("Not allowed file type: {0}"), blobType));
}
if (getProject().isReviewRequiredForModification(user, blobIdent.revision, blobPath))
throw new BlobEditException(_T("Review required for this change. Please submit pull request instead"));
else if (getProject().isBuildRequiredForModification(user, blobIdent.revision, blobPath))
throw new BlobEditException(_T("Build required for this change. Please submit pull request instead"));
else if (getProject().isCommitSignatureRequiredButNoSigningKey(user, blobIdent.revision))
signRequired = true;
BlobContent blobContent = new BlobContent(item.get(), FileMode.REGULAR_FILE.getBits());
newBlobs.put(blobPath, blobContent);
}
BlobEdits blobEdits = new BlobEdits(Sets.newHashSet(), newBlobs);
String refName = blobIdent.revision!=null? GitUtils.branch2ref(blobIdent.revision):"refs/heads/main";
ObjectId prevCommitId;
if (blobIdent.revision != null)
prevCommitId = getProject().getRevCommit(blobIdent.revision, true).copy();
else
prevCommitId = ObjectId.zeroId();
View on GitHub (pinned to d44925c47c)
Solutions
- Create a branch, commit there, and open a pull request for review
- Adjust the branch protection review-required rules if direct commits should be allowed
- Commit as a user/role exempt from the review requirement, if your setup defines one
Example fix
// before: commit directly to main via web editor // after: edit on branch feature/x, push, then open a pull request against main
Defensive patterns
Strategy: validation
Validate before calling
if (project.isReviewRequiredForModification(user, revision, path)) {
// route user to create-branch + PR flow instead of direct commit
} Try / catch
try {
saveBlob();
} catch (BlobEditException e) {
offerPullRequestWorkflow();
} Prevention
- Default to branch+PR flow for edits on protected branches
- Check review-required path rules before web-editing critical files
- Keep branch protection rules documented for contributors
When it happens
Trigger: Direct web-editor commit to a branch whose protection marks the changed file path as review-required (review requirement matching the blob path).
Common situations: Editing protected files (e.g. build specs, critical config) on main via the web UI; a path-based review rule was added after the user last edited the file.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- errorMessage (from checkMergeCondition)
- Error checking merge commit message: ${errorMessage}
- Not allowed file type: {0}
- Build required for this change. Please submit pull request i
- Reviewer not found:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/dc282eed3fab6ebc.
Report an issue: GitHub.