flowable/flowable-engine · error · FlowableObjectNotFoundException

No historic task exists with the given id:

Error message

No historic task exists with the given id: 

What it means

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.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricIdentityLinksForTaskCmd.java:54

    private static final long serialVersionUID = 1L;
    
    protected String taskId;

    public GetHistoricIdentityLinksForTaskCmd(String taskId) {
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("taskId is required");
        }
        this.taskId = taskId;
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Override
    public List<HistoricIdentityLink> execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        HistoricTaskInstanceEntity task = cmmnEngineConfiguration.getTaskServiceConfiguration().getHistoricTaskService().getHistoricTask(taskId);

        if (task == null) {
            throw new FlowableObjectNotFoundException("No historic task exists with the given id: " + taskId, HistoricTaskInstance.class);
        }

        HistoricIdentityLinkService historicIdentityLinkService = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getHistoricIdentityLinkService();
        List<HistoricIdentityLinkEntity> identityLinks = historicIdentityLinkService.findHistoricIdentityLinksByTaskId(taskId);

        HistoricIdentityLinkEntity assigneeIdentityLink = null;
        HistoricIdentityLinkEntity ownerIdentityLink = null;
        for (HistoricIdentityLinkEntity historicIdentityLink : identityLinks) {
            if (IdentityLinkType.ASSIGNEE.equals(historicIdentityLink.getType())) {
                assigneeIdentityLink = historicIdentityLink;

            } else if (IdentityLinkType.OWNER.equals(historicIdentityLink.getType())) {
                ownerIdentityLink = historicIdentityLink;
            }
        }

        // Similar to GetIdentityLinksForTask, return assignee and owner as identity link
        if (task.getAssignee() != null && assigneeIdentityLink == null) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the task exists and has been archived to history (check ACT_HI_TASK_INST / CMMN equivalent) using the exact id.
  2. If the task may still be running, query the task/query API first and fall back to the historic API only after completion.
  3. Confirm you are querying the correct engine (CMMN vs process) for the id.

Example fix

// before
List<HistoricIdentityLink> links = cmmnHistoryService.getHistoricIdentityLinksForTask(taskId);
// after
HistoricTaskInstance task = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
List<HistoricIdentityLink> links = task != null
    ? cmmnHistoryService.getHistoricIdentityLinksForTask(taskId)
    : Collections.emptyList();
Defensive patterns

Strategy: try-catch

Validate before calling

HistoricTaskInstance t = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
if (t == null) { throw new NotFoundException("No historic task " + taskId); }

Type guard

boolean historicTaskExists = cmmnHistoryService.createHistoricTaskInstanceQuery().taskId(id).count() > 0;

Try / catch

try { return historyService.getHistoricIdentityLinksForTask(taskId); } catch (FlowableObjectNotFoundException e) { log.warn("Historic task not found: {}", taskId); return Collections.emptyList(); }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/13461d53a93cf31f. Report an issue: GitHub.