{"record":{"id":"2154f4a285e9d58d","repo":"flowable/flowable-engine","slug":"error-is-null","errorCode":null,"errorMessage":"error is null","messagePattern":"error is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/HandleCaseTaskErrorCmd.java","lineNumber":47,"sourceCode":" * by propagating it as a BPMN error on the parent CaseTask execution.\n * The full BusinessError is passed through so that error data (code, message,\n * additional data) is preserved for boundary error event variable mapping.\n *\n * @author Joram Barrez\n */\npublic class HandleCaseTaskErrorCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String executionId;\n    protected BusinessError error;\n\n    public HandleCaseTaskErrorCmd(String executionId, BusinessError error) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        if (error == null) {\n            throw new FlowableIllegalArgumentException(\"error is null\");\n        }\n        this.executionId = executionId;\n        this.error = error;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getExecutionEntityManager().findById(executionId);\n        if (execution == null) {\n            throw new FlowableException(\"No execution could be found for id \" + executionId);\n        }\n\n        ErrorPropagation.propagateError(error, execution);\n        return null;\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/HandleCaseTaskErrorCmd.java#L29-L65","documentation":"The HandleCaseTaskErrorCmd constructor throws FlowableIllegalArgumentException(\"error is null\") when the BusinessError argument is null. The command exists solely to propagate a business error into the case execution, so a null error makes the operation undefined.","triggerScenarios":"new HandleCaseTaskErrorCmd(executionId, null) — e.g. the BusinessError was parsed from an event payload that lacked error details, or a factory returned null on unknown error codes.","commonSituations":"Mapping an inbound error code to a BusinessError via a registry that misses the code and returns null; deserialization of error payloads producing null; test scaffolding omitting the error.","solutions":["Ensure a non-null BusinessError instance is built before constructing the command.","Make the error-code-to-BusinessError mapping fail loudly (throw) instead of returning null for unknown codes.","Validate the inbound payload so error details are always present when error propagation is triggered.","Catch FlowableIllegalArgumentException and log/report the missing business error context."],"exampleFix":"// before\nBusinessError err = errorRegistry.get(code); // may be null\nmanagementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, err));\n// after\nBusinessError err = errorRegistry.get(code);\nif (err == null) {\n    throw new IllegalArgumentException(\"Unknown business error code: \" + code);\n}\nmanagementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, err));","handlingStrategy":"validation","validationCode":"if (error == null) {\n    throw new IllegalArgumentException(\"BusinessError must be provided for error propagation\");\n}","typeGuard":"boolean hasBusinessError(BusinessError e) { return e != null; }","tryCatchPattern":"try {\n    managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, error));\n} catch (FlowableIllegalArgumentException e) {\n    throw new BadRequestException(\"BusinessError is required: \" + e.getMessage(), e);\n}","preventionTips":["Make error-code lookups throw on unknown codes instead of returning null","Validate inbound error payloads before triggering propagation","Cover error-mapping factories with unit tests for unknown codes"],"tags":["flowable","cmmn","null-argument","business-error"],"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"}