{"record":{"id":"bda2d2da5bbaa146","repo":"flowable/flowable-engine","slug":"the-business-status-is-mandatory-but-null-has-b","errorCode":null,"errorMessage":"The business status is mandatory, but 'null' has been provided.","messagePattern":"The business status is mandatory, but 'null' has been provided\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceBusinessStatusCmd.java","lineNumber":45,"sourceCode":"\n/**\n * {@link Command} that changes the business status of an existing process instance.\n *\n * @author Tijs Rademakers\n */\npublic class SetProcessInstanceBusinessStatusCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private final String processInstanceId;\n    private final String businessStatus;\n\n    public SetProcessInstanceBusinessStatusCmd(String processInstanceId, String businessStatus) {\n        if (processInstanceId == null || processInstanceId.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"The process instance id is mandatory, but '\" + processInstanceId + \"' has been provided.\");\n        }\n        if (businessStatus == null) {\n            throw new FlowableIllegalArgumentException(\"The business status is mandatory, but 'null' has been provided.\");\n        }\n\n        this.processInstanceId = processInstanceId;\n        this.businessStatus = businessStatus;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ExecutionEntityManager executionManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExecutionEntity processInstance = executionManager.findById(processInstanceId);\n        if (processInstance == null) {\n            throw new FlowableObjectNotFoundException(\"No process instance found for id = '\" + processInstanceId + \"'.\", ProcessInstance.class);\n\n        } else if (!processInstance.isProcessInstanceType()) {\n            throw new FlowableIllegalArgumentException(\"A process instance id is required, but the provided id \" + \"'\" + processInstanceId + \"' \" + \"points to a child execution of process instance \" + \"'\"\n                    + processInstance.getProcessInstanceId() + \"'. \" + \"Please invoke the \" + getClass().getSimpleName() + \" with a root execution id.\");\n        }\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceBusinessStatusCmd.java#L27-L63","documentation":"Constructor validation in SetProcessInstanceBusinessStatusCmd: processInstanceId was fine but the businessStatus argument is null/empty. Since setting an empty status is meaningless, the command is rejected at construction with the offending value interpolated in the message.","triggerScenarios":"Calling RuntimeService.setProcessInstanceBusinessStatus(processInstanceId, null).","commonSituations":"DTO field not populated before the call, or developer assuming null clears the status.","solutions":["Pass a non-null status string (use \"\" if a blank status is intended).","Validate/normalize the status field in the DTO before the service call.","If the goal is to remove the status, set an empty string instead of null."],"exampleFix":"// before\nruntimeService.setProcessInstanceBusinessStatus(id, businessStatus); // null\n// after\nruntimeService.setProcessInstanceBusinessStatus(id, businessStatus == null ? \"\" : businessStatus);","handlingStrategy":"validation","validationCode":"if (businessStatus == null) {\n    throw new IllegalArgumentException(\"businessStatus is required; use \\\"\\\" to clear\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.setProcessInstanceBusinessStatus(id, status);\n} catch (FlowableIllegalArgumentException e) {\n    // handle null business status\n}","preventionTips":["Default null statuses to \"\" in your wrapper layer.","Populate DTO fields fully before invoking the API.","Remember null is never accepted for business status."],"tags":["validation","process-instance","null-argument"],"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"}