{"record":{"id":"13461d53a93cf31f","repo":"flowable/flowable-engine","slug":"no-historic-task-exists-with-the-given-id","errorCode":null,"errorMessage":"No historic task exists with the given id: ","messagePattern":"No historic task exists with the given id: ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricIdentityLinksForTaskCmd.java","lineNumber":54,"sourceCode":"    private static final long serialVersionUID = 1L;\n    \n    protected String taskId;\n\n    public GetHistoricIdentityLinksForTaskCmd(String taskId) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is required\");\n        }\n        this.taskId = taskId;\n    }\n\n    @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n    @Override\n    public List<HistoricIdentityLink> execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        HistoricTaskInstanceEntity task = cmmnEngineConfiguration.getTaskServiceConfiguration().getHistoricTaskService().getHistoricTask(taskId);\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"No historic task exists with the given id: \" + taskId, HistoricTaskInstance.class);\n        }\n\n        HistoricIdentityLinkService historicIdentityLinkService = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getHistoricIdentityLinkService();\n        List<HistoricIdentityLinkEntity> identityLinks = historicIdentityLinkService.findHistoricIdentityLinksByTaskId(taskId);\n\n        HistoricIdentityLinkEntity assigneeIdentityLink = null;\n        HistoricIdentityLinkEntity ownerIdentityLink = null;\n        for (HistoricIdentityLinkEntity historicIdentityLink : identityLinks) {\n            if (IdentityLinkType.ASSIGNEE.equals(historicIdentityLink.getType())) {\n                assigneeIdentityLink = historicIdentityLink;\n\n            } else if (IdentityLinkType.OWNER.equals(historicIdentityLink.getType())) {\n                ownerIdentityLink = historicIdentityLink;\n            }\n        }\n\n        // Similar to GetIdentityLinksForTask, return assignee and owner as identity link\n        if (task.getAssignee() != null && assigneeIdentityLink == null) {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricIdentityLinksForTaskCmd.java#L36-L72","documentation":"During execute, GetHistoricIdentityLinksForTaskCmd loads the historic task via HistoricTaskService.getHistoricTask(taskId). If no historic task exists with that id, it throws FlowableObjectNotFoundException including the id, because identity links can only be listed for an existing historic task.","triggerScenarios":"Calling the command/history API with a taskId that was never created, points to a runtime (not yet historic) task, or belongs to the process engine rather than the CMMN engine.","commonSituations":"Querying before case/task completion (task not yet archived to history), typos or stale ids from cached clients, cross-engine id confusion (BPMN task id passed to CMMN history service).","solutions":["Verify the task exists and has been archived to history (check ACT_HI_TASK_INST / CMMN equivalent) using the exact id.","If the task may still be running, query the task/query API first and fall back to the historic API only after completion.","Confirm you are querying the correct engine (CMMN vs process) for the id."],"exampleFix":"// before\nList<HistoricIdentityLink> links = cmmnHistoryService.getHistoricIdentityLinksForTask(taskId);\n// after\nHistoricTaskInstance task = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();\nList<HistoricIdentityLink> links = task != null\n    ? cmmnHistoryService.getHistoricIdentityLinksForTask(taskId)\n    : Collections.emptyList();","handlingStrategy":"try-catch","validationCode":"HistoricTaskInstance t = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();\nif (t == null) { throw new NotFoundException(\"No historic task \" + taskId); }","typeGuard":"boolean historicTaskExists = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(id).count() > 0;","tryCatchPattern":"try { return historyService.getHistoricIdentityLinksForTask(taskId); } catch (FlowableObjectNotFoundException e) { log.warn(\"Historic task not found: {}\", taskId); return Collections.emptyList(); }","preventionTips":["Check the task exists in history before fetching identity links","If the task may still be running, use the runtime task API first","Verify the id belongs to the CMMN engine, not the BPMN engine"],"tags":["flowable","cmmn","not-found","history"],"backgroundTag":"entity-not-found","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"}