{"record":{"id":"42c24c505dbfb268","repo":"flowable/flowable-engine","slug":"type-is-null-42c24c","errorCode":null,"errorMessage":"type is null","messagePattern":"type is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/delegate/event/impl/ActivitiEventImpl.java","lineNumber":46,"sourceCode":"    protected FlowableEngineEventType type;\n    protected String executionId;\n    protected String processInstanceId;\n    protected String processDefinitionId;\n\n    /**\n     * Creates a new event implementation, not part of an execution context.\n     */\n    public ActivitiEventImpl(FlowableEngineEventType type) {\n        this(type, null, null, null);\n    }\n\n    /**\n     * Creates a new event implementation, part of an execution context.\n     */\n    public ActivitiEventImpl(FlowableEngineEventType type, String executionId, String processInstanceId,\n            String processDefinitionId) {\n        if (type == null) {\n            throw new ActivitiIllegalArgumentException(\"type is null\");\n        }\n        this.type = type;\n        this.executionId = executionId;\n        this.processInstanceId = processInstanceId;\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    public FlowableEngineEventType getType() {\n        return type;\n    }\n\n    public void setType(FlowableEngineEventType type) {\n        this.type = type;\n    }\n\n    public String getExecutionId() {\n        return executionId;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/delegate/event/impl/ActivitiEventImpl.java#L28-L64","documentation":"ActivitiEventImpl is the base class of all engine events; its constructor requires a FlowableEngineEventType and rejects null with ActivitiIllegalArgumentException(\"type is null\"). The event type drives listener dispatch, so an event without a type cannot be routed.","triggerScenarios":"new ActivitiEventImpl(null, executionId, processInstanceId, processDefinitionId) or a subclass/builder call passing a null FlowableEngineEventType (e.g. a computed type variable that resolved to null).","commonSituations":"Custom listeners building events with a type looked up from a map or switch that returned null; mapping unknown event names to types; hand-written event constructors in tests.","solutions":["Pass a concrete FlowableEngineEventType constant (e.g. FlowableEngineEventType.PROCESS_STARTED).","Validate/normalize the type lookup before constructing the event, falling back to a known default.","Ensure custom dispatchers use ActivitiEventBuilder factory methods which never pass null types."],"exampleFix":"// before\nFlowableEngineEventType type = TYPE_MAP.get(eventName);\nnew ActivitiEventImpl(type, execId, procId, defId); // type may be null\n// after\nFlowableEngineEventType type = TYPE_MAP.getOrDefault(eventName, FlowableEngineEventType.CUSTOM);\nnew ActivitiEventImpl(type, execId, procId, defId);","handlingStrategy":"validation","validationCode":"if (type == null) type = FlowableEngineEventType.CUSTOM;","typeGuard":"FlowableEngineEventType safeType(FlowableEngineEventType t) { return t != null ? t : FlowableEngineEventType.CUSTOM; }","tryCatchPattern":"try { dispatcher.dispatchEvent(new ActivitiEventImpl(type, e1, e2, e3)); } catch (ActivitiIllegalArgumentException e) { logger.error(\"Event type null\", e); }","preventionTips":["Use ActivitiEventBuilder instead of constructing events directly","Make type lookups total (getOrDefault with a known constant)","Never map event names to types with functions that can return null"],"tags":["events","null-argument","enum","constructor"],"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"}