{"record":{"id":"6c4b538f113c3a7b","repo":"flowable/flowable-engine","slug":"task-6c4b53","errorCode":null,"errorMessage":"Task '","messagePattern":"Task '","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":102,"sourceCode":"                    variableFound = true;\n                }\n            }\n\n        } else if (variableScope == RestVariableScope.GLOBAL) {\n            if (ScopeTypes.CMMN.equals(task.getScopeType()) && task.getScopeId() != null && runtimeService.hasVariable(task.getScopeId(), variableName)) {\n                value = runtimeService.getVariable(task.getScopeId(), variableName);\n                variableFound = true;\n            }\n\n        } else if (variableScope == RestVariableScope.LOCAL) {\n            if (taskService.hasVariableLocal(taskId, variableName)) {\n                value = taskService.getVariableLocal(taskId, variableName);\n                variableFound = true;\n            }\n        }\n\n        if (!variableFound) {\n            throw new FlowableObjectNotFoundException(\"Task '\" + taskId + \"' doesn't have a variable with name: '\" + variableName + \"'.\", VariableInstanceEntity.class);\n        } else {\n            return restResponseFactory.createRestVariable(variableName, value, variableScope, taskId, CmmnRestResponseFactory.VARIABLE_TASK, includeBinary);\n        }\n    }\n\n    protected boolean hasVariableOnScope(Task task, String variableName, RestVariableScope scope) {\n        boolean variableFound = false;\n\n        if (scope == RestVariableScope.GLOBAL) {\n            if (ScopeTypes.CMMN.equals(task.getScopeType()) && task.getScopeId() != null && runtimeService.hasVariable(task.getScopeId(), variableName)) {\n                variableFound = true;\n            }\n\n        } else if (scope == RestVariableScope.LOCAL) {\n            if (taskService.hasVariableLocal(task.getId(), variableName)) {\n                variableFound = true;\n            }\n        }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java#L84-L120","documentation":"When reading a task variable via the CMMN REST API, if the variable is not found in the requested scope (global or local) the API throws FlowableObjectNotFoundException (HTTP 404) naming the task id and variable name. This distinguishes 'task exists but variable absent' from other errors.","triggerScenarios":"GET /cmmn-runtime/tasks/{taskId}/variables/{variableName} (or scoped variants) where the variable name never existed on the task, was set only in the other scope, or was deleted.","commonSituations":"Typos in variable names; querying a local-only variable without /local and vice versa; reading after task completion removed runtime variables; case/prefix mismatch between services.","solutions":["Check available names first via GET /cmmn-runtime/tasks/{taskId}/variables.","Add scope qualifier: use /variables/{name}/local for local variables.","Handle 404 gracefully with a default value in the client.","Fix the variable name spelling or set the variable before reading it."],"exampleFix":"// before\nGET /cmmn-runtime/tasks/123/variables/approvl  // 404\n\n// after\nGET /cmmn-runtime/tasks/123/variables/approval  // correct name\nGET /cmmn-runtime/tasks/123/variables/approval/local  // if local-scoped","handlingStrategy":"try-catch","validationCode":"const all = await api.get(`/cmmn-runtime/tasks/${taskId}/variables`);\nconst exists = all.some(v => v.name === variableName);","typeGuard":null,"tryCatchPattern":"try { return await api.get(`/cmmn-runtime/tasks/${taskId}/variables/${name}`); } catch (e) { if (e.response && e.response.status === 404) return defaultValue; throw e; }","preventionTips":["List task variables before reading a specific one","Use the correct /local scope path for local variables","Centralize variable name constants to avoid typos"],"tags":["rest-api","cmmn","variables","not-found"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}