flowable/flowable-engine · error · FlowableIllegalArgumentException
Provided element id is null
Error message
Provided element id is null
What it means
ExternalWorkerJobQuery.elementId(String) throws FlowableIllegalArgumentException when the provided flow element id is null. The element id filter targets jobs attached to a specific BPMN element (service task, etc.); null is rejected as an invalid argument. Supply a real element id from the model or drop the filter.
Solutions
- Pass the BPMN element id (e.g. the service task's id attribute).
- Guard the call site with a null check before applying the filter.
- Resolve the element id from the process definition model, handling missing elements explicitly.
- Log the null element id to surface upstream model issues.
Example fix
// before
query.elementId(flowElement.getId());
// after
if (flowElement != null) {
query.elementId(flowElement.getId());
} Defensive patterns
Strategy: validation
Validate before calling
if (elementId != null && !elementId.isBlank()) {
query.elementId(elementId);
} Type guard
boolean hasElementId(String id) { return id != null && !id.isBlank(); } Try / catch
try {
query.elementId(elementId);
} catch (FlowableIllegalArgumentException e) {
throw new IllegalStateException("Cannot filter jobs: element id unresolved", e);
} Prevention
- Resolve element ids from the deployed BPMN model, failing fast if absent.
- Keep job-to-element references intact when renaming elements in the model.
- Log unresolved element references to catch model drift early.
When it happens
Trigger: Calling externalWorkerJobQuery().elementId(null), e.g. when the element id is read from a FlowElement or execution that is not job-related.
Common situations: Retry tooling that resolves the failing element dynamically and the resolution fails; BPMN parsing where the activity reference is missing; generic job inspectors passing through null element references.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f39fbac93852d96e.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobQueryImpl.java:201
}
@Override
public ExternalWorkerJobQuery categoryLike(String categoryLike) {
if (categoryLike == null) {
throw new FlowableIllegalArgumentException("Provided categoryLike is null");
}
if (inOrStatement) {
this.currentOrQueryObject.categoryLike = categoryLike;
} else {
this.categoryLike = categoryLike;
}
return this;
}
@Override
public ExternalWorkerJobQuery elementId(String elementId) {
if (elementId == null) {
throw new FlowableIllegalArgumentException("Provided element id is null");
}
if (inOrStatement) {
this.currentOrQueryObject.elementId = elementId;
} else {
this.elementId = elementId;
}
return this;
}
@Override
public ExternalWorkerJobQuery elementIds(Collection<String> elementIds) {
if (elementIds == null) {
throw new FlowableIllegalArgumentException("Provided element ids are null");
}
if (inOrStatement) {
this.currentOrQueryObject.elementIds = elementIds;
} else {
this.elementIds = elementIds;View on GitHub (pinned to d6d39ce1c6)