theonedev/onedev · error · NotAcceptableException
Code comment is already resolved/unresolved
Error message
Code comment is already resolved/unresolved
What it means
DefaultCodeCommentStatusChangeService.create guards against duplicate status changes: if the comment is already in the requested resolved/unresolved state, recording another identical change would be a no-op and is rejected.
Source
Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultCodeCommentStatusChangeService.java:44
import io.onedev.server.persistence.annotation.Sessional;
import io.onedev.server.persistence.annotation.Transactional;
import io.onedev.server.service.CodeCommentStatusChangeService;
@Singleton
public class DefaultCodeCommentStatusChangeService extends BaseEntityService<CodeCommentStatusChange>
implements CodeCommentStatusChangeService {
@Inject
private ListenerRegistry listenerRegistry;
@Transactional
@Override
public void create(CodeCommentStatusChange change, String note) {
Preconditions.checkState(change.isNew());
CodeComment comment = change.getComment();
if (comment.isResolved() == change.isResolved())
throw new NotAcceptableException("Code comment is already " + (change.isResolved() ? "resolved" : "unresolved"));
comment.setResolved(change.isResolved());
dao.persist(change);
if (note != null) {
CodeCommentReply reply = new CodeCommentReply();
reply.setComment(comment);
reply.setCompareContext(change.getCompareContext());
reply.setContent(note);
reply.setDate(new Date(change.getDate().getTime() - 100));
reply.setUser(change.getUser());
dao.persist(reply);
comment.setReplyCount(comment.getReplyCount()+1);
}
listenerRegistry.post(new CodeCommentStatusChanged(change, note));
View on GitHub (pinned to d44925c47c)
Solutions
- Check the comment's current resolved state before recording a status change.
- Skip the change when the target state equals the current state.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultCodeCommentStatusChangeService.java:44 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/2873fb4d1d627bf3.
Report an issue: GitHub.