DeleteConnectionHandler.execute exception when dropping EventBasedGateway with connection

Hi, I am trying to bring on a canvas EventBasedGateway and IntermediateCatchEvent connected and this specific combination always fails with exception in DeleteConnectionHandler.execute. If i change EventBasedGateway to just a Task - it works. Any ideas?

Here is sandbox code:

  const gateway = elementFactory.createShape({
    type: "bpmn:EventBasedGateway", // - doesnt work
    //type: "bpmn:Task", // - works
    x: 0,
    y: 0
  });

  const event = elementFactory.createShape({
    type: "bpmn:IntermediateCatchEvent",
    eventDefinitionType: "bpmn:MessageEventDefinition",
    x: 120,
    y: 120
  });

  const waypoints = [
    { x: gateway.x, y: gateway.y },
    { x: event.x, y: event.y }
  ];

  const connection = elementFactory.createConnection({
    type: "bpmn:SequenceFlow",
    source: gateway,
    target: event,
    waypoints
  });
  const elements = [gateway, event, connection];
  create.start(e, elements);

Here is the execption:

index.js:27 TypeError: Cannot read properties of undefined (reading 'children')
    at DeleteConnectionHandler.execute (DeleteConnectionHandler.js:15)
    at eval (CommandStack.js:169)
    at CommandStack._atomicDo (CommandStack.js:146)
    at CommandStack._internalExecute (CommandStack.js:166)
    at CommandStack.execute (CommandStack.js:32)
    at Modeling.removeConnection (Modeling.js:266)
    at eval (EventBasedGatewayBehavior.js:19)
    at Array.forEach (<anonymous>)
    at eval (EventBasedGatewayBehavior.js:18)
    at invokeFunction (EventBus.js:201)
    at EventBus._invokeListener (EventBus.js:126)
    at EventBus._invokeListeners (EventBus.js:118)
    at EventBus.fire (EventBus.js:93)
    at CommandStack._fire (CommandStack.js:132)
    at CommandStack._internalExecute (CommandStack.js:164)
    at CommandStack.execute (CommandStack.js:32)
    at Modeling.createConnection (Modeling.js:167)
    at eval (CreateElementsHandler.js:43)
    at forEach (index.esm.js:330)
    at CreateElementsHandler.preExecute (CreateElementsHandler.js:41)
    at CommandStack._internalExecute (CommandStack.js:162)
    at CommandStack.execute (CommandStack.js:32)
    at Modeling.createElements (Modeling.js:211)
    at eval (Create.js:122)
    at invokeFunction (EventBus.js:201)
    at EventBus._invokeListener (EventBus.js:126)
    at EventBus._invokeListeners (EventBus.js:118)
    at EventBus.fire (EventBus.js:93)
    at fire (Dragging.js:44)
    at end (Dragging.js:98)
    at HTMLDocument.trapClickAndEnd (Dragging.js:119)

I was able to reproduce it and it looks like a bug in the library. Can you please create a bug report for this? Use this link: Sign in to GitHub · GitHub

Thank you. Here is defect DeleteConnectionHandler.execute exception when dropping EventBasedGateway with connection · Issue #1490 · bpmn-io/bpmn-js · GitHub

1 Like