{"record":{"id":"a366d8881318e751","repo":"flowable/flowable-engine","slug":"messagename-cannot-be-null","errorCode":null,"errorMessage":"messageName cannot be null","messagePattern":"messageName cannot be null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java","lineNumber":68,"sourceCode":"            this.payload = new HashMap<>(processVariables);\r\n\r\n        } else {\r\n            this.payload = null;\r\n        }\r\n        this.async = false;\r\n    }\r\n\r\n    public MessageEventReceivedCmd(String messageName, String executionId, boolean async) {\r\n        super(executionId);\r\n        this.messageName = messageName;\r\n        this.payload = null;\r\n        this.async = async;\r\n    }\r\n\r\n    @Override\r\n    protected Void execute(CommandContext commandContext, ExecutionEntity execution) {\r\n        if (messageName == null) {\r\n            throw new FlowableIllegalArgumentException(\"messageName cannot be null\");\r\n        }\r\n\r\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\r\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\r\n            compatibilityHandler.messageEventReceived(messageName, executionId, payload, async);\r\n            return null;\r\n        }\r\n\r\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\r\n        EventSubscriptionService eventSubscriptionService = processEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService();\r\n        List<EventSubscriptionEntity> eventSubscriptions = eventSubscriptionService.findEventSubscriptionsByNameAndExecution(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, executionId);\r\n\r\n        if (eventSubscriptions.isEmpty()) {\r\n            throw new FlowableException(execution + \" does not have a subscription to a message event with name '\" + messageName + \"'\");\r\n        }\r\n\r\n        // there can be only one:\r\n        EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0);\r","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java#L50-L86","documentation":"MessageEventReceivedCmd.execute() validates that a messageName was supplied before delivering a message to a waiting execution; a null messageName throws FlowableIllegalArgumentException. Correlating a message event requires the name that the message start/boundary/intermediate event subscribed with.","triggerScenarios":"Calling runtimeService.messageEventReceived(null, executionId) or messageEventReceived(null, executionId, payload), or building MessageEventReceivedCmd with a null messageName.","commonSituations":"The message name comes from an incoming webhook/queue message field that is null; variable holding the name not set; mixing up messageName with executionId argument order.","solutions":["Pass the exact message name declared on the BPMN message event element.","If the name comes from external input, null/empty-check before calling the runtime service.","Use runtimeService.createExecutionQuery().messageEventSubscriptionName(name) to confirm the name you intend to use.","Catch FlowableIllegalArgumentException when the message may legitimately lack a name and log/skip."],"exampleFix":"// before\nruntimeService.messageEventReceived(msgName, executionId); // msgName may be null\n// after\nif (msgName == null || msgName.isEmpty()) {\n    throw new IllegalArgumentException(\"Message name missing from payload\");\n}\nruntimeService.messageEventReceived(msgName, executionId);","handlingStrategy":"validation","validationCode":"if (messageName == null || messageName.isBlank()) {\n    throw new IllegalArgumentException(\"messageName is required to correlate a message event\");\n}","typeGuard":"boolean isValidMessageName(String n) { return n != null && !n.isBlank(); }","tryCatchPattern":"try {\n    runtimeService.messageEventReceived(messageName, executionId, payload);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Cannot deliver message: {}\", e.getMessage());\n}","preventionTips":["Reference message names via constants matching BPMN messageRef values","Null/empty-check names extracted from external message payloads","Don't confuse messageName and executionId parameter order"],"tags":["flowable","message-event","null-check","validation"],"backgroundTag":"missing-required-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"}