{"record":{"id":"7086cbab2240eb2d","repo":"flowable/flowable-engine","slug":"the-command-is-null","errorCode":null,"errorMessage":"The command is null","messagePattern":"The command is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/CmmnManagementServiceImpl.java","lineNumber":345,"sourceCode":"    \n    @Override\n    public void unacquireAllExternalWorkerJobsForWorker(String workerId) {\n        commandExecutor.execute(new UnacquireAllExternalWorkerJobsForWorkerCmd(workerId, null, configuration.getJobServiceConfiguration()));\n    }\n    \n    @Override\n    public void unacquireAllExternalWorkerJobsForWorker(String workerId, String tenantId) {\n        commandExecutor.execute(new UnacquireAllExternalWorkerJobsForWorkerCmd(workerId, tenantId, configuration.getJobServiceConfiguration()));\n    }\n    \n    @Override\n    public ChangeTenantIdBuilder createChangeTenantIdBuilder(String fromTenantId, String toTenantId) {\n        return new ChangeTenantIdBuilderImpl(fromTenantId, toTenantId, configuration.getChangeTenantIdManager());\n    }\n\n    public <T> T executeCommand(Command<T> command) {\n        if (command == null) {\n            throw new FlowableIllegalArgumentException(\"The command is null\");\n        }\n        return commandExecutor.execute(command);\n    }\n\n    public <T> T executeCommand(CommandConfig config, Command<T> command) {\n        if (config == null) {\n            throw new FlowableIllegalArgumentException(\"The config is null\");\n        }\n        if (command == null) {\n            throw new FlowableIllegalArgumentException(\"The command is null\");\n        }\n        return commandExecutor.execute(config, command);\n    }\n    \n    @Override\n    public LockManager getLockManager(String lockName) {\n        return new LockManagerImpl(commandExecutor, lockName, getConfiguration().getLockPollRate(), configuration.getEngineCfgKey());\n    }","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/CmmnManagementServiceImpl.java#L327-L363","documentation":"Null check in CmmnManagementServiceImpl.executeCommand(Command): the command argument is null so nothing can be executed. This is the escape hatch for running arbitrary custom Commands against the CMMN engine.","triggerScenarios":"Calling cmmnManagementService.executeCommand(null); commonly a factory method returning null when building the Command.","commonSituations":"Building commands conditionally and passing the result straight in; a helper that returns null on a missing tenant/config; unit tests passing uninitialized command variables.","solutions":["Pass a non-null Command instance; check whatever builds the command for null-returning paths","Guard the call site: if (command != null) cmmnManagementService.executeCommand(command)","Fix the command factory to throw its own descriptive error instead of returning null"],"exampleFix":"// before\nCommand<MyResult> cmd = buildCommand(ctx);\ncmmnManagementService.executeCommand(cmd);\n// after\nCommand<MyResult> cmd = buildCommand(ctx);\nObjects.requireNonNull(cmd, \"command must not be null\");\ncmmnManagementService.executeCommand(cmd);","handlingStrategy":"validation","validationCode":"if (command == null) throw new IllegalArgumentException(\"command required\");","typeGuard":null,"tryCatchPattern":"try { managementService.executeCommand(cmd); } catch (FlowableIllegalArgumentException e) { /* null command */ }","preventionTips":["Never let command factories return null; throw instead","Check conditional command construction paths","Use Objects.requireNonNull before executing"],"tags":["java","null-check","command","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-14T11:17:12.474Z"}