{"record":{"id":"107a955b3b6c6f7e","repo":"flowable/flowable-engine","slug":"historic-process-instance-processinstanceid-107a95","errorCode":null,"errorMessage":"Historic process instance '\" + processInstanceId + \"' variable value for \" + variableName + \" could not be found.","messagePattern":"Historic process instance '\" \\+ processInstanceId \\+ \"' variable value for \" \\+ variableName \\+ \" could not be found\\.","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricProcessInstanceVariableDataResource.java","lineNumber":106,"sourceCode":"        }\n    }\n\n    public RestVariable getVariableFromRequest(boolean includeBinary, String processInstanceId, String variableName) {\n\n        HistoricProcessInstance processObject = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult();\n\n        if (processObject == null) {\n            throw new FlowableObjectNotFoundException(\"Historic process instance '\" + processInstanceId + \"' could not be found.\", HistoricProcessInstanceEntity.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessHistoryProcessInfoById(processObject);\n        }\n\n        Object value = processObject.getProcessVariables().get(variableName);\n\n        if (value == null) {\n            throw new FlowableObjectNotFoundException(\"Historic process instance '\" + processInstanceId + \"' variable value for \" + variableName + \" could not be found.\", VariableInstanceEntity.class);\n        } else {\n            return restResponseFactory.createRestVariable(variableName, value, null, processInstanceId, RestResponseFactory.VARIABLE_HISTORY_PROCESS, includeBinary);\n        }\n    }\n}\n","sourceCodeStart":88,"sourceCodeEnd":112,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricProcessInstanceVariableDataResource.java#L88-L112","documentation":"The historic process instance exists, but the requested variable name is not among its persisted process variables, so Flowable throws FlowableObjectNotFoundException for VariableInstanceEntity. Note the value==null check also fires if the historic variable value itself was stored as null.","triggerScenarios":"GET /history/historic-process-instances/{id}/variables/{variableName} where variableName was never set on the process (or via getVariableFromRequest with an unknown/wrong variable name).","commonSituations":"Variable renamed in a later process definition version; variable scoped to a task, not the process; misspelled variable name; history level 'activity' does not persist variable values so nothing is found.","solutions":["List available variables first: GET /history/historic-process-instances/{id}/variables and confirm the exact name","Correct the variableName spelling/casing in the client request","If the variable lives on a task, query the historic task instance variables endpoint instead","Raise history level to 'audit' (or 'full') so process variables are recorded in history"],"exampleFix":"// before\nRestVariable v = getVariableFromRequest(true, procInstId, \"OrderAmount\");\n// after\nMap<String, Object> vars = historyService.createHistoricProcessInstanceQuery()\n    .processInstanceId(procInstId).includeProcessVariables().singleResult().getProcessVariables();\nif (vars.containsKey(\"orderAmount\")) {\n    RestVariable v = getVariableFromRequest(true, procInstId, \"orderAmount\");\n}","handlingStrategy":"validation","validationCode":"HistoricProcessInstance p = historyService.createHistoricProcessInstanceQuery()\n    .processInstanceId(id).includeProcessVariables().singleResult();\nif (p == null || !p.getProcessVariables().containsKey(variableName)) {\n    throw new IllegalArgumentException(\"Variable not found: \" + variableName);\n}","typeGuard":null,"tryCatchPattern":"try { return getHistoryVariable(id, name); }\ncatch (FlowableObjectNotFoundException e) { return Collections.emptyMap(); }","preventionTips":["List all historic variables before fetching one by name","Match variable name and casing exactly as set in the process","For task-scoped variables use the historic task variable endpoints"],"tags":["rest-api","variables","not-found","flowable"],"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"}