flowable/flowable-engine · error · FlowableIllegalArgumentException
latest can only be used together with a deployment key
Error message
latest can only be used together with a deployment key
What it means
Thrown by CmmnDeploymentQueryImpl.latest() when called before deploymentKey(). The 'latest' flag is only meaningful as 'latest deployment with this key'; without a key the semantics are undefined, so Flowable rejects the combination.
Solutions
- Call deploymentKey("yourKey") before .latest(): createCmmnDeploymentQuery().deploymentKey(key).latest()
- If you truly want the newest deployment regardless of key, sort by deployment time and take the first result instead of using latest()
- Reorder the fluent chain so the key filter precedes latest()
Example fix
// before
CmmnDeployment d = repositoryService.createCmmnDeploymentQuery().latest().singleResult();
// after
CmmnDeployment d = repositoryService.createCmmnDeploymentQuery()
.deploymentKey("myDeploymentKey")
.latest()
.singleResult(); Defensive patterns
Strategy: validation
Validate before calling
if (key == null) {
throw new IllegalStateException("deploymentKey must be set before latest()");
}
CmmnDeployment d = repositoryService.createCmmnDeploymentQuery()
.deploymentKey(key).latest().singleResult(); Try / catch
try {
CmmnDeployment d = query.latest().singleResult();
} catch (FlowableIllegalArgumentException e) {
// add the missing deploymentKey(...) call or use a different strategy
} Prevention
- Always pair latest() with a preceding deploymentKey() call
- Encapsulate 'latest deployment by key' in one helper method
- Do not use latest() for global 'newest deployment' queries; order by deployment time instead
When it happens
Trigger: Calling createCmmnDeploymentQuery().latest() without a preceding deploymentKey(...) call, or calling latest() after building a query filtered only by category/tenant.
Common situations: Trying to fetch 'the latest deployment' overall rather than per key; reordering fluent calls so latest() runs before deploymentKey(); copy-pasted query code that dropped the key filter.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- activatedBefore is null
- activity tenant id is null
- after time is null
- category is null
- categoryLike is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/816eddc4595e5b24.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentQueryImpl.java:177
throw new FlowableIllegalArgumentException("parentDeploymentIdLike is null");
}
this.parentDeploymentIdLike = parentDeploymentIdLike;
return this;
}
@Override
public CmmnDeploymentQueryImpl parentDeploymentIds(List<String> parentDeploymentIds) {
if (parentDeploymentIds == null) {
throw new FlowableIllegalArgumentException("parentDeploymentIds is null");
}
this.parentDeploymentIds = parentDeploymentIds;
return this;
}
@Override
public CmmnDeploymentQueryImpl latest() {
if (key == null) {
throw new FlowableIllegalArgumentException("latest can only be used together with a deployment key");
}
this.latest = true;
return this;
}
// sorting ////////////////////////////////////////////////////////
@Override
public CmmnDeploymentQuery orderByDeploymentId() {
return orderBy(CmmnDeploymentQueryProperty.DEPLOYMENT_ID);
}
@Override
public CmmnDeploymentQuery orderByDeploymentTime() {
return orderBy(CmmnDeploymentQueryProperty.DEPLOY_TIME);
}
View on GitHub (pinned to d6d39ce1c6)