{"record":{"id":"03c0735fa0ab6020","repo":"flowable/flowable-engine","slug":"id-is-empty","errorCode":null,"errorMessage":"id is empty","messagePattern":"id is empty","errorType":"validation","errorClass":"org.flowable.common.engine.api.FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java","lineNumber":59,"sourceCode":"    protected Collection<String> taskIds;\n    protected String processInstanceId;\n    protected String executionId;\n    protected Collection<String> executionIds;\n    protected boolean withoutTaskId;\n    protected String scopeId;\n    protected Collection<String> scopeIds;\n    protected String subScopeId;\n    protected Collection<String> subScopeIds;\n    protected boolean withoutSubScopeId;\n    protected String scopeType;\n    protected Collection<String> scopeTypes;\n    protected String name;\n    protected Collection<String> names;\n\n    @Override\n    public InternalVariableInstanceQuery id(String id) {\n        if (StringUtils.isEmpty(id)) {\n            throw new FlowableIllegalArgumentException(\"id is empty\");\n        }\n        this.id = id;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery taskId(String taskId) {\n        if (StringUtils.isEmpty(taskId)) {\n            throw new FlowableIllegalArgumentException(\"taskId is empty\");\n        }\n\n        if (withoutTaskId) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine taskId(String) with withoutTaskId() in the same query\");\n        }\n\n        this.taskId = taskId;\n        return this;\n    }","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java#L41-L77","documentation":"InternalVariableInstanceQuery.id() throws FlowableIllegalArgumentException when the id argument is null or an empty string (StringUtils.isEmpty). A variable instance query by id is meaningless without an identifier, so the empty case is rejected up front instead of yielding an empty or malformed database query.","triggerScenarios":"Calling internalVariableInstanceQuery.id(null) or id(\"\") — typically an id variable that was never set, or an id stripped to empty by trimming/parsing.","commonSituations":"An id passed as a method parameter from an upstream layer where it was optional; deserialization of a payload missing the id field; string manipulation (e.g. substring/split) accidentally producing an empty id.","solutions":["Pass a valid non-empty variable instance id string.","Check StringUtils.isNotBlank(id) before invoking the query and handle the missing-id case in your code.","If ids are resolved dynamically, verify the lookup succeeded before building the query.","If querying by something other than id is intended, use the appropriate filter (name, taskId, executionId) instead."],"exampleFix":"// before\ninternalQuery.id(variableInstanceId);\n\n// after\nif (variableInstanceId != null && !variableInstanceId.isEmpty()) {\n    internalQuery.id(variableInstanceId);\n} else {\n    throw new IllegalArgumentException(\"variableInstanceId is required\");\n}","handlingStrategy":"validation","validationCode":"if (id == null || id.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"variable instance id is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    internalQuery.id(id);\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Missing variable instance id for query\", e);\n}","preventionTips":["Validate ids at the boundary (API/DTO layer) before they reach query builders.","Use StringUtils.isNotBlank rather than plain null checks for identifier inputs.","Fail fast with your own descriptive exception when an id is missing instead of relying on library messages."],"tags":["flowable","query","empty-argument","validation"],"backgroundTag":"empty-required-field","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"}