flowable/flowable-engine · error · ActivitiException
In order to use comments, history should be enabled
Error message
In order to use comments, history should be enabled
What it means
ActivitiException thrown by CommentEntityManager.checkHistoryEnabled when a comment/event operation runs while history is disabled. Comments are implemented as history events, so with history level 'none' insert, delete, and all query methods reject the call. The engine fails fast rather than writing comments it could never read back.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/entity/CommentEntityManager.java:151
public List<Comment> findCommentsByProcessInstanceId(String processInstanceId, String type) {
checkHistoryEnabled();
Map<String, Object> params = new HashMap<>();
params.put("processInstanceId", processInstanceId);
params.put("type", type);
return getDbSqlSession().selectListWithRawParameter("selectCommentsByProcessInstanceIdAndType", params, 0, Integer.MAX_VALUE);
}
public Comment findComment(String commentId) {
return getDbSqlSession().selectById(CommentEntity.class, commentId);
}
public Event findEvent(String commentId) {
return getDbSqlSession().selectById(CommentEntity.class, commentId);
}
protected void checkHistoryEnabled() {
if (!getHistoryManager().isHistoryEnabled()) {
throw new ActivitiException("In order to use comments, history should be enabled");
}
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Enable history: set process.engine.history to 'activity' or higher in the engine configuration
- Guard comment operations behind a historyEnabled check and degrade gracefully (e.g., store comments in an external service)
- Catch ActivitiException around comment APIs when history support is optional in your deployment
- Document that comments/attachments require history when choosing the history level
Example fix
// before
try {
taskService.addComment(taskId, processInstanceId, message);
} catch (ActivitiException e) { /* comment lost */ }
// after (enable history in config)
processEngineConfig.setHistory(HistoryLevel.ACTIVITY.getKey());
taskService.addComment(taskId, processInstanceId, message); Defensive patterns
Strategy: try-catch
Validate before calling
if (!processEngine.getProcessEngineConfiguration().getHistoryManager().isHistoryEnabled()) {
throw new IllegalStateException("Comments require history to be enabled");
} Try / catch
try {
taskService.addComment(taskId, processInstanceId, message);
} catch (ActivitiException e) {
if (e.getMessage().contains("history should be enabled")) {
// fallback: persist comment in an application-owned table
} else throw e;
} Prevention
- Never configure history=none if comments/attachments are used
- Gate collaboration features on history configuration at startup
- Include history level in environment smoke tests
When it happens
Trigger: Calling TaskService.addComment(...), taskService.getTaskComments(...), getProcessInstanceComments, getComment/deleteComment, or any of the finder methods listed, while history is disabled (history=none).
Common situations: Performance-tuned engines with history=none encountering collaboration features (task comments) at runtime; code migrated from an environment with history enabled into one without.
Related errors
- In order to use comments, history should be enabled
- In order to use attachments, history should be enabled
- Setting a deployment name is not supported for apps
- CommandInvoker must be the last interceptor in the chain
- In order to use attachments, history should be enabled
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/49538536a67ec0b4.
Report an issue: GitHub.