Node red crashing after deployment

Node red crashes after making changes to flows and deploying it. i get the following error in logs.

[error] TypeError: Cannot read properties of undefined (reading 'update')
    at start (/opt/node_modules/@node-red/runtime/lib/flows/index.js:349:31)

After crashing sometimes it restarts to normal state and sometimes I have to restart and it works without issues.

Please tell us more about your system.
What hardware/OS?
How did you install node red?
Start node red in a terminal and post the full startup log up to the the error message, including any trace or other output that follows the error.