{"record":{"id":"d6cb7781cd10a15a","repo":"flowable/flowable-engine","slug":"processinstanceid-is-empty","errorCode":null,"errorMessage":"processInstanceId is empty","messagePattern":"processInstanceId 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":95,"sourceCode":"    }\n\n    @Override\n    public InternalVariableInstanceQuery taskIds(Collection<String> taskIds) {\n        if (taskIds == null || taskIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"taskIds is null or empty\");\n        }\n\n        if (withoutTaskId) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine taskIds(Collection) with withoutTaskId() in the same query\");\n        }\n        this.taskIds = taskIds;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery processInstanceId(String processInstanceId) {\n        if (StringUtils.isEmpty(processInstanceId)) {\n            throw new FlowableIllegalArgumentException(\"processInstanceId is empty\");\n        }\n        this.processInstanceId = processInstanceId;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery executionId(String executionId) {\n        if (StringUtils.isEmpty(executionId)) {\n            throw new FlowableIllegalArgumentException(\"executionId is empty\");\n        }\n        this.executionId = executionId;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery executionIds(Collection<String> executionIds) {\n        if (executionIds == null || executionIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"executionIds is null or empty\");","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java#L77-L113","documentation":"InternalVariableInstanceQueryImpl.processInstanceId(String) throws FlowableIllegalArgumentException when the given processInstanceId is null or empty. Filtering variables by process instance requires a concrete id; blank input is rejected eagerly at query-build time instead of issuing a meaningless database query.","triggerScenarios":"Calling processInstanceId(null) or processInstanceId(\"\") — e.g. a process instance that was never started, an id read from an empty request parameter, or an unset field.","commonSituations":"Process id sourced from a form/HTTP parameter not yet filled; code running before the process instance is persisted; whitespace-only strings pass isEmpty and may return zero rows.","solutions":["Resolve a valid non-empty process instance id before building the query","Skip the query and return an empty result when no id is available","Validate the id at the entry point of your service (e.g. @NotBlank)"],"exampleFix":"// before\nquery.processInstanceId(processInstanceId); // throws when blank\n// after\nif (processInstanceId != null && !processInstanceId.isEmpty()) {\n    query.processInstanceId(processInstanceId);\n} else {\n    return Collections.emptyList();\n}","handlingStrategy":"validation","validationCode":"if (processInstanceId == null || processInstanceId.isEmpty()) { throw new IllegalArgumentException(\"processInstanceId required\"); }","typeGuard":"boolean hasProcessInstanceId(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try { query.processInstanceId(pid); } catch (FlowableIllegalArgumentException e) { log.warn(\"Missing processInstanceId for variable query\", e); return Collections.emptyList(); }","preventionTips":["Validate process instance ids from request parameters before querying","Only query variables after the process instance is started and persisted","Use @NotBlank validation on DTO fields carrying the id"],"tags":["flowable","query-builder","argument-validation","null-argument"],"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"}