theonedev/onedev · error · ExplicitException
Comment too long
Error message
Comment too long
What it means
IssueCommentPanel.onSaveComment() enforces IssueComment.MAX_CONTENT_LEN: a comment longer than the maximum throws this ExplicitException before any persistence happens. The limit keeps issue activity content and storage within sane bounds.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/component/issue/activities/activity/IssueCommentPanel.java:104
Model.of(OneDev.getInstance(UrlService.class).urlFor(getComment(), true)),
_T("Copy permanent link")));
add(new CommentPanel("body") {
@Override
protected String getComment() {
return IssueCommentPanel.this.getComment().getContent();
}
@Override
protected boolean isQuoteEnabled() {
return true;
}
@Override
protected void onSaveComment(AjaxRequestTarget target, String comment) {
if (comment.length() > IssueComment.MAX_CONTENT_LEN)
throw new ExplicitException("Comment too long");
var entity = IssueCommentPanel.this.getComment();
var oldComment = entity.getContent();
if (!oldComment.equals(comment)) {
transactionService.run(() -> {
entity.setContent(comment);
entity.setRevisionCount(entity.getRevisionCount() + 1);
issueCommentService.update(entity);
var revision = new IssueCommentRevision();
revision.setComment(entity);
revision.setUser(SecurityUtils.getUser());
revision.setOldContent(oldComment);
revision.setNewContent(comment);
dao.persist(revision);
});
var page = (BasePage) getPage();
page.notifyObservablesChange(target, entity.getIssue().getChangeObservables(false));
}View on GitHub (pinned to d44925c47c)
Solutions
- Shorten the comment below IssueComment.MAX_CONTENT_LEN characters.
- Attach large logs/files as issue attachments and keep only a summary in the comment.
- Use a code block with only the relevant excerpt, or link to an external gist/artifact.
Example fix
// before
panel.onSaveComment(target, entireBuildLog);
// after
String content = entireBuildLog.length() > IssueComment.MAX_CONTENT_LEN
? entireBuildLog.substring(0, IssueComment.MAX_CONTENT_LEN) + "... (truncated, see attachment)"
: entireBuildLog;
panel.onSaveComment(target, content); Defensive patterns
Strategy: validation
Validate before calling
if (comment != null && comment.length() > IssueComment.MAX_CONTENT_LEN)
feedback.error("Comment exceeds " + IssueComment.MAX_CONTENT_LEN + " characters"); Type guard
static boolean isCommentLengthOk(String s) {
return s != null && s.length() <= IssueComment.MAX_CONTENT_LEN;
} Try / catch
try {
panel.onSaveComment(target, comment);
} catch (ExplicitException e) {
feedback.error("Comment too long; attach large logs as files instead");
} Prevention
- Truncate or attach large logs/files instead of pasting into comments.
- Show a live character counter in the comment editor.
- Enforce the same MAX_CONTENT_LEN limit in any API/script that creates comments.
When it happens
Trigger: Saving an issue comment whose length exceeds IssueComment.MAX_CONTENT_LEN, typically by pasting a very large log, stack trace, or document into the comment editor.
Common situations: Pasting multi-thousand-line CI logs or files into issue comments; API/scripts creating long issue comments; migrations importing verbose ticket bodies.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- Query is too long. Max {MAX_QUERY_LENGTH} characters
- Comment too long
- Title is required
- Count should not be greater than ${RestConstants.MAX_PAGE_SI
- ${e.getMessage()}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/13a377c4dec5fe88.
Report an issue: GitHub.