{"record":{"id":"a03041589c1d9d45","repo":"flowable/flowable-engine","slug":"task-a03041","errorCode":null,"errorMessage":"task ","messagePattern":"task ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskDataObjectsCmd.java","lineNumber":74,"sourceCode":"\n    public GetTaskDataObjectsCmd(String taskId, Collection<String> variableNames, String locale, boolean withLocalizationFallback) {\n        this.taskId = taskId;\n        this.variableNames = variableNames;\n        this.locale = locale;\n        this.withLocalizationFallback = withLocalizationFallback;\n    }\n\n    @Override\n    public Map<String, DataObject> execute(CommandContext commandContext) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"task \" + taskId + \" doesn't exist\", Task.class);\n        }\n\n        Map<String, DataObject> dataObjects = null;\n        Map<String, VariableInstance> variables = null;\n        if (variableNames == null) {\n            variables = task.getVariableInstances();\n        } else {\n            variables = task.getVariableInstances(variableNames, false);\n        }\n\n        if (variables != null) {\n            dataObjects = new HashMap<>(variables.size());\n\n            for (Entry<String, VariableInstance> entry : variables.entrySet()) {\n                VariableInstance variableEntity = entry.getValue();\n\n                String localizedName = null;\n                String localizedDescription = null;","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskDataObjectsCmd.java#L56-L92","documentation":"GetTaskDataObjectsCmd loads the task by id via TaskService.getTask(taskId) and throws FlowableObjectNotFoundException(\"task <id> doesn't exist\", Task.class) when no matching task row is found, so the variables map cannot be built.","triggerScenarios":"Calling taskService.getDataObjects(taskId, ...) with a taskId that does not exist in ACT_RU_TASK: deleted task, wrong engine/database, or an id from a completed-and-purged task.","commonSituations":"Copy-pasting ids across environments; race where the task is completed and removed between fetch and call; incorrect tenant or engine configuration pointing at another schema.","solutions":["Confirm the task exists with taskService.createTaskQuery().taskId(taskId).singleResult() before fetching data objects","Catch FlowableObjectNotFoundException and handle the missing-task case gracefully (re-query the task list)","Verify engine/database configuration matches the environment the taskId came from"],"exampleFix":"// before\nMap<String, DataObject> vars = taskService.getDataObjects(taskId); // throws\n// after\nTask task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task != null) {\n    Map<String, DataObject> vars = taskService.getDataObjects(taskId);\n}","handlingStrategy":"try-catch","validationCode":"boolean exists = taskService.createTaskQuery().taskId(taskId).count() > 0;","typeGuard":"boolean taskExists(String taskId) {\n    return taskId != null\n        && taskService.createTaskQuery().taskId(taskId).count() > 0;\n}","tryCatchPattern":"try {\n    Map<String, DataObject> vars = taskService.getDataObjects(taskId);\n} catch (FlowableObjectNotFoundException e) {\n    // task no longer exists; return empty map or re-fetch\n    vars = Collections.emptyMap();\n}","preventionTips":["Avoid stale task ids; re-query before batch variable reads","Check tenant/engine routing so ids resolve in the right database"],"tags":["java","flowable","not-found","task"],"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"}