{"record":{"id":"25b3902bbb42393a","repo":"flowable/flowable-engine","slug":"instanceid-is-null","errorCode":null,"errorMessage":"instanceId is null","messagePattern":"instanceId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/HistoricDecisionExecutionQueryImpl.java","lineNumber":108,"sourceCode":"            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n        this.deploymentId = deploymentId;\n        return this;\n    }\n    \n    @Override\n    public DmnHistoricDecisionExecutionQuery decisionKey(String decisionKey) {\n        if (decisionKey == null) {\n            throw new FlowableIllegalArgumentException(\"decisionKey is null\");\n        }\n        this.decisionKey = decisionKey;\n        return this;\n    }\n\n    @Override\n    public DmnHistoricDecisionExecutionQuery instanceId(String instanceId) {\n        if (instanceId == null) {\n            throw new FlowableIllegalArgumentException(\"instanceId is null\");\n        }\n        this.instanceId = instanceId;\n        return this;\n    }\n    \n    @Override\n    public DmnHistoricDecisionExecutionQuery executionId(String executionId) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        this.executionId = executionId;\n        return this;\n    }\n    \n    @Override\n    public DmnHistoricDecisionExecutionQuery activityId(String activityId) {\n        if (activityId == null) {\n            throw new FlowableIllegalArgumentException(\"activityId is null\");","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/HistoricDecisionExecutionQueryImpl.java#L90-L126","documentation":"HistoricDecisionExecutionQueryImpl.instanceId(String) throws FlowableIllegalArgumentException when the instanceId argument is null. The instance id scopes historic decision executions to a process/case instance; because a null would create an invalid filter, the builder validates and throws immediately.","triggerScenarios":"Calling dmnHistoryService.createHistoricDecisionExecutionQuery().instanceId(null), commonly when the process instance id is taken from an execution context that is absent (e.g. decision invoked standalone, outside a process instance).","commonSituations":"Standalone DMN evaluations that have no instance id but code unconditionally filters by it; asynchronous jobs whose execution context no longer resolves; handlers that copy instanceId from a request body that omitted it.","solutions":["Only call instanceId(...) when the code actually runs within a process/case instance with a valid id","Branch on context: for standalone evaluations query by decisionKey/deploymentId instead of instanceId","Null-check the instance id source before chaining the filter"],"exampleFix":"// before\nquery.instanceId(execution.getProcessInstanceId()); // null for standalone decisions\n// after\nString pid = execution != null ? execution.getProcessInstanceId() : null;\nif (pid != null) {\n    query.instanceId(pid);\n} else {\n    query.decisionKey(decisionKey);\n}","handlingStrategy":"validation","validationCode":"if (instanceId == null) { throw new IllegalArgumentException(\"instanceId required when filtering decision history by instance\"); }","typeGuard":"boolean hasInstanceId(DelegateExecution ex) { return ex != null && ex.getProcessInstanceId() != null; }","tryCatchPattern":"try { query.instanceId(pid); } catch (FlowableIllegalArgumentException e) { log.info(\"Standalone decision evaluation; skipping instanceId filter\"); }","preventionTips":["Recognize that standalone DMN calls have no process instance id; use alternate filters there","Null-check execution context accessors (getProcessInstanceId) before using them"],"tags":["flowable","dmn","history","query","null-check"],"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"}