theonedev/onedev · warning · ExplicitException
Description too long
Error message
Description too long
What it means
OneDev throws this ExplicitException when a user tries to save a pull request description longer than PullRequest.MAX_DESCRIPTION_LEN characters. The check runs inside changeDescription before persisting, because the description column has a hard length limit. It is a deliberate validation guard, not a bug.
Source
Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestChangeService.java:125
PullRequestChange change = new PullRequestChange();
change.setDate(new Date());
change.setRequest(request);
change.setData(new PullRequestTitleChangeData(prevTitle, title));
change.setUser(user);
create(change, null);
dao.persist(request);
}
}
@Transactional
@Override
public void changeDescription(User user, PullRequest request, @Nullable String description) {
String prevDescription = request.getDescription();
if (!Objects.equals(description, prevDescription)) {
if (description != null && description.length() > PullRequest.MAX_DESCRIPTION_LEN)
throw new ExplicitException("Description too long");
request.setDescription(description);
request.setDescriptionRevisionCount(request.getDescriptionRevisionCount() + 1);
referenceChangeService.addReferenceChange(user, request, description);
PullRequestChange change = new PullRequestChange();
change.setRequest(request);
change.setUser(user);
change.setData(new PullRequestDescriptionChangeData(prevDescription, request.getDescription()));
create(change, null);
dao.persist(request);
var revision = new PullRequestDescriptionRevision();
revision.setRequest(request);
revision.setUser(user);
revision.setOldContent(prevDescription);
revision.setNewContent(description);
dao.persist(revision);
}View on GitHub (pinned to d44925c47c)
Solutions
- Shorten the description to at most PullRequest.MAX_DESCRIPTION_LEN characters before calling changeDescription
- Truncate or abbreviate the text programmatically (e.g. StringUtils.abbreviate(description, PullRequest.MAX_DESCRIPTION_LEN))
- If the full content matters, link to an external document or attach it as a file/comment instead of the description
Example fix
// before prService.changeDescription(user, request, hugeGeneratedNotes); // throws "Description too long" // after String desc = StringUtils.abbreviate(hugeGeneratedNotes, PullRequest.MAX_DESCRIPTION_LEN); prService.changeDescription(user, request, desc);
Defensive patterns
Strategy: validation
Validate before calling
if (description != null && description.length() > PullRequest.MAX_DESCRIPTION_LEN)
throw new IllegalArgumentException("description exceeds " + PullRequest.MAX_DESCRIPTION_LEN + " chars"); Type guard
boolean isAcceptableDescription(String d) {
return d == null || d.length() <= PullRequest.MAX_DESCRIPTION_LEN;
} Try / catch
try {
changeService.changeDescription(user, request, description);
} catch (ExplicitException e) {
// show "Description too long" to the user / truncate and retry
} Prevention
- Validate description length in the UI/form with a maxlength bound
- Truncate programmatically with StringUtils.abbreviate before saving
- Store very long content in attachments or linked documents
When it happens
Trigger: Calling DefaultPullRequestChangeService.changeDescription(user, request, description) (directly or via the REST/UI edit-description endpoint) with a non-null description string whose length() exceeds PullRequest.MAX_DESCRIPTION_LEN.
Common situations: Pasting large markdown documents, generated release notes, or long logs into the PR description; API scripts that programmatically set descriptions from unbounded text.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Pull request submitter cannot be reviewer
- Error validating param auto merge commit message:
- This pull request is not eligible for auto-merge, as it can
- Error validating auto merge commit message:
- Title is required
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/3f0fb9b86a12c24e.
Report an issue: GitHub.