flowable/flowable-engine · error · FlowableIllegalArgumentException
modelId is null
Error message
modelId is null
What it means
Identical guard to GetModelEditorSourceCmd but for the extra editor source: GetModelEditorSourceExtraCmd.execute throws FlowableIllegalArgumentException('modelId is null') when invoked without a model id. The command retrieves the auxiliary source bytes (e.g. extra JSON) attached to a model, which requires a valid id. Fail-fast validation before any entity lookup.
Solutions
- Null-check the id before the call and raise a domain-specific error
- Verify the model exists via repositoryService.createModelQuery() before fetching extra source
- Validate incoming REST/model parameters before invoking the repository API
- Debug the upstream code path that produced a null id (usually a null singleResult)
Example fix
// before
byte[] extra = repositoryService.getModelEditorSourceExtra(modelId);
// after
if (modelId == null) {
throw new IllegalArgumentException("modelId required to fetch editor source extra");
}
byte[] extra = repositoryService.getModelEditorSourceExtra(modelId); Defensive patterns
Strategy: validation
Validate before calling
if (modelId == null || modelId.trim().isEmpty()) {
throw new IllegalArgumentException("modelId must be provided before fetching extra source");
} Type guard
boolean validModelId(String id) { return id != null && !id.trim().isEmpty(); } Try / catch
try {
byte[] extra = repositoryService.getModelEditorSourceExtra(modelId);
} catch (FlowableIllegalArgumentException e) {
throw new IllegalArgumentException("model id required", e);
} Prevention
- Validate ids at the controller/REST layer before service calls
- Trace upstream queries that can return null and propagate null ids
- Assert model existence with a model query before fetching source bytes
When it happens
Trigger: Calling RepositoryService.getModelEditorSourceExtra(null); commonly the id was never set because an earlier model query returned null or the caller passed a variable that was never initialized.
Common situations: REST endpoints where the modelId path variable is missing/empty; unit tests constructing the command directly with a null constructor arg; code moved from one model object to another losing the id in between.
Related errors
- modelId is null
- appsDefinitionIds is null
- at least one of userId or groups must be provided
- Business status is null
- Candidate user is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2b80baf1710d1da5.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetModelEditorSourceExtraCmd.java:37
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.util.CommandContextUtil;
/**
* @author Tijs Rademakers
*/
public class GetModelEditorSourceExtraCmd implements Command<byte[]>, Serializable {
private static final long serialVersionUID = 1L;
protected String modelId;
public GetModelEditorSourceExtraCmd(String modelId) {
this.modelId = modelId;
}
@Override
public byte[] execute(CommandContext commandContext) {
if (modelId == null) {
throw new FlowableIllegalArgumentException("modelId is null");
}
byte[] bytes = CommandContextUtil.getModelEntityManager(commandContext).findEditorSourceExtraByModelId(modelId);
return bytes;
}
}
View on GitHub (pinned to d6d39ce1c6)