{"record":{"id":"b69e76123fb82250","repo":"flowable/flowable-engine","slug":"in-order-to-use-comments-history-should-be-enable","errorCode":null,"errorMessage":"In order to use comments, history should be enabled","messagePattern":"In order to use comments, history should be enabled","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/CommentEntityManagerImpl.java","lineNumber":192,"sourceCode":"            // Forced to fetch the process-instance to associate the right\n            // process definition\n            String processDefinitionId = null;\n            String processInstanceId = comment.getProcessInstanceId();\n            if (comment.getProcessInstanceId() != null) {\n                ExecutionEntity process = getExecutionEntityManager().findById(comment.getProcessInstanceId());\n                if (process != null) {\n                    processDefinitionId = process.getProcessDefinitionId();\n                }\n            }\n            getEventDispatcher().dispatchEvent(FlowableEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_DELETED, \n                    commentEntity, processInstanceId, processInstanceId, processDefinitionId),\n                    engineConfiguration.getEngineCfgKey());\n        }\n    }\n\n    protected void checkHistoryEnabled() {\n        if (!getHistoryManager().isHistoryEnabled()) {\n            throw new FlowableException(\"In order to use comments, history should be enabled\");\n        }\n    }\n\n    protected ExecutionEntityManager getExecutionEntityManager() {\n        return engineConfiguration.getExecutionEntityManager();\n    }\n\n    protected HistoryManager getHistoryManager() {\n        return engineConfiguration.getHistoryManager();\n    }\n\n}\n","sourceCodeStart":174,"sourceCodeEnd":205,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/CommentEntityManagerImpl.java#L174-L205","documentation":"Comments (and events) are persisted through the history subsystem in Flowable. CommentEntityManagerImpl.checkHistoryEnabled() throws this FlowableException when any comment insert/update or comment/event query runs while history is disabled.","triggerScenarios":"Calling TaskService.addComment, updating a comment, findCommentsByTaskId, findCommentsByTaskIdAndType, findCommentsByType, or findEventsByTaskId while the engine history level is NONE.","commonSituations":"Engine configured with history=none for throughput; comment code added to an existing app that was configured without history; test environment config differing from production where history is on.","solutions":["Enable history in the engine configuration (setHistoryLevel(HistoryLevel.ACTIVITY) or higher, or flowable.history-level=activity in config).","Ensure the history tables (ACT_HI_*) exist by running the engine's schema update after enabling history.","If history must stay disabled, remove/feature-flag all comment usage — comments are unsupported without history."],"exampleFix":"// before\nProcessEngineConfiguration cfg = ...;\ncfg.setHistoryLevel(HistoryLevel.NONE);\ntaskService.addComment(taskId, processInstanceId, \"note\"); // throws\n// after\nProcessEngineConfiguration cfg = ...;\ncfg.setHistoryLevel(HistoryLevel.AUDIT);\ntaskService.addComment(taskId, processInstanceId, \"note\");","handlingStrategy":"validation","validationCode":"// Java: guard comment APIs\nif (!processEngine.getProcessEngineConfiguration().getHistoryManager().isHistoryEnabled()) {\n    throw new IllegalStateException(\"Comments require history to be enabled\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.addComment(taskId, processInstanceId, message);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"history should be enabled\")) {\n        // enable history or route comments to an alternate store\n    } else { throw e; }\n}","preventionTips":["Enable history (ACTIVITY or higher) if any comment/event API is used.","Check history settings in application startup tests.","Avoid turning history off without auditing all features that depend on it.","Feature-flag comment code paths when history is disabled."],"tags":["history","configuration","flowable","comments"],"backgroundTag":"feature-not-enabled","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}