{"record":{"id":"2b80baf1710d1da5","repo":"flowable/flowable-engine","slug":"modelid-is-null-2b80ba","errorCode":null,"errorMessage":"modelId is null","messagePattern":"modelId is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetModelEditorSourceExtraCmd.java","lineNumber":37,"sourceCode":"import org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.engine.impl.util.CommandContextUtil;\n\n/**\n * @author Tijs Rademakers\n */\npublic class GetModelEditorSourceExtraCmd implements Command<byte[]>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String modelId;\n\n    public GetModelEditorSourceExtraCmd(String modelId) {\n        this.modelId = modelId;\n    }\n\n    @Override\n    public byte[] execute(CommandContext commandContext) {\n        if (modelId == null) {\n            throw new FlowableIllegalArgumentException(\"modelId is null\");\n        }\n\n        byte[] bytes = CommandContextUtil.getModelEntityManager(commandContext).findEditorSourceExtraByModelId(modelId);\n\n        return bytes;\n    }\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":46,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetModelEditorSourceExtraCmd.java#L19-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before\nbyte[] extra = repositoryService.getModelEditorSourceExtra(modelId);\n// after\nif (modelId == null) {\n    throw new IllegalArgumentException(\"modelId required to fetch editor source extra\");\n}\nbyte[] extra = repositoryService.getModelEditorSourceExtra(modelId);","handlingStrategy":"validation","validationCode":"if (modelId == null || modelId.trim().isEmpty()) {\n  throw new IllegalArgumentException(\"modelId must be provided before fetching extra source\");\n}","typeGuard":"boolean validModelId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try {\n  byte[] extra = repositoryService.getModelEditorSourceExtra(modelId);\n} catch (FlowableIllegalArgumentException e) {\n  throw new IllegalArgumentException(\"model id required\", e);\n}","preventionTips":["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"],"tags":["flowable","null-argument","model","validation"],"backgroundTag":"null-argument","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"}