{"record":{"id":"a1f34f26ac00b3ba","repo":"flowable/flowable-engine","slug":"task-does-not-have-a-comment-with-id","errorCode":null,"errorMessage":"Task '' does not have a comment with id ''.","messagePattern":"Task '' does not have a comment with id ''\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCommentResource.java","lineNumber":54,"sourceCode":" * @author Frederik Heremans\n */\n@RestController\n@Api(tags = { \"Task Comments\" }, authorizations = { @Authorization(value = \"basicAuth\") })\npublic class TaskCommentResource extends TaskBaseResource {\n\n    @ApiOperation(value = \" Get a comment on a task\", tags = { \"Task Comments\" }, nickname = \"getTaskComment\")\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the task and comment were found and the comment is returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested task was not found or the tasks does not have a comment with the given ID.\")\n    })\n    @GetMapping(value = \"/runtime/tasks/{taskId}/comments/{commentId}\", produces = \"application/json\")\n    public CommentResponse getComment(@ApiParam(name = \"taskId\") @PathVariable(\"taskId\") String taskId, @ApiParam(name = \"commentId\") @PathVariable(\"commentId\") String commentId) {\n\n        HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);\n\n        Comment comment = taskService.getComment(commentId);\n        if (comment == null || !task.getId().equals(comment.getTaskId())) {\n            throw new FlowableObjectNotFoundException(\"Task '\" + task.getId() + \"' does not have a comment with id '\" + commentId + \"'.\", Comment.class);\n        }\n\n        return restResponseFactory.createRestComment(comment);\n    }\n\n    @ApiOperation(value = \"Delete a comment on a task\", tags = { \"Task Comments\" }, nickname = \"deleteTaskComment\", code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the task and comment were found and the comment is deleted. Response body is left empty intentionally.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested task was not found or the tasks does not have a comment with the given ID.\")\n    })\n    @DeleteMapping(value = \"/runtime/tasks/{taskId}/comments/{commentId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void deleteComment(@ApiParam(name = \"taskId\") @PathVariable(\"taskId\") String taskId, @ApiParam(name = \"commentId\") @PathVariable(\"commentId\") String commentId) {\n\n        // Check if task exists\n        Task task = getTaskFromRequestWithoutAccessCheck(taskId);\n\n        Comment comment = taskService.getComment(commentId);","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCommentResource.java#L36-L72","documentation":"Reading a task comment via GET /runtime/tasks/{taskId}/comments/{commentId} throws FlowableObjectNotFoundException when the comment id does not exist or exists but belongs to a different task. The comment is looked up by id and its taskId must match the requested task.","triggerScenarios":"GET /runtime/tasks/{taskId}/comments/{commentId} where commentId is unknown, already deleted, or attached to another task's id.","commonSituations":"Stale ids cached by a client after comment deletion; copying a comment id from another task; historic-task endpoint used with a comment on the runtime task of a different id.","solutions":["Verify the commentId exists via GET /runtime/tasks/{taskId}/comments and use one from the list","Confirm the comment belongs to the same taskId in the URL path","Re-fetch the comment list if the comment was recently deleted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const comments = await get(`/runtime/tasks/${taskId}/comments`);\nif (!comments.some(c => c.id === commentId)) return null;","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) { if (e.status === 404) return null; throw e; }","preventionTips":["Always resolve comment ids from the task's comment list","Never cache comment ids across tasks","Treat 404 as 'already gone' in cleanup jobs"],"tags":["rest","not-found","flowable","comments"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}