{"record":{"id":"d2de7eb91048cba7","repo":"flowable/flowable-engine","slug":"caseinstanceid-is-null-d2de7e","errorCode":null,"errorMessage":"caseInstanceId is null","messagePattern":"caseInstanceId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCaseVariableInstancesCmd.java","lineNumber":42,"sourceCode":"import org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.variable.api.persistence.entity.VariableInstance;\n\npublic class GetCaseVariableInstancesCmd implements Command<Map<String, VariableInstance>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected String caseInstanceId;\n\n    public GetCaseVariableInstancesCmd(String caseInstanceId) {\n        this.caseInstanceId = caseInstanceId;\n    }\n\n    @Override\n    public Map<String, VariableInstance> execute(CommandContext commandContext) {\n\n        // Verify existence of execution\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"caseInstanceId is null\");\n        }\n\n        CaseInstanceEntity caseInstance = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceId);\n\n        if (caseInstance == null) {\n            throw new FlowableObjectNotFoundException(\"case instance \" + caseInstanceId + \" doesn't exist\", CaseInstance.class);\n        }\n\n        return caseInstance.getVariableInstances();\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":54,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCaseVariableInstancesCmd.java#L24-L54","documentation":"GetCaseVariableInstancesCmd validates that a caseInstanceId was supplied before it looks up the case instance. A null id cannot identify any case, so Flowable throws FlowableIllegalArgumentException immediately. This is a caller contract violation, not an engine-state problem.","triggerScenarios":"Calling caseService.getVariables(caseInstanceId) / getVariableInstances with a null caseInstanceId, typically when the id comes from an unset field, failed lookup, or unvalidated request payload.","commonSituations":"REST endpoint where the id path/query parameter was absent; bean property never populated; result of an earlier query that returned null and was passed on unguarded.","solutions":["Pass a valid non-null caseInstanceId to the API","Validate the id (non-null, non-empty) at the API boundary before calling the engine","Trace the id's origin and fix why it is null"],"exampleFix":"// before\nMap<String, VariableInstance> vars = caseService.getVariableInstances(caseInstanceId);\n// after\nif (caseInstanceId == null) {\n    throw new IllegalArgumentException(\"caseInstanceId must be provided\");\n}\nMap<String, VariableInstance> vars = caseService.getVariableInstances(caseInstanceId);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(caseInstanceId, \"caseInstanceId is required\");","typeGuard":"boolean hasId = caseInstanceId != null && !caseInstanceId.isEmpty();","tryCatchPattern":"try { return caseService.getVariables(caseInstanceId); } catch (FlowableIllegalArgumentException e) { log.error(\"Null caseInstanceId\"); throw e; }","preventionTips":["Reject missing id path/query parameters at the REST layer","Avoid passing possibly-null query results onward","Use @NotNull-style bean validation on DTOs"],"tags":["java","flowable","null-check","argument-validation"],"backgroundTag":"null-argument","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"}