Why appium crashes randomly with this error " Error: Can't set headers after they are sent."

error: Unexpected error: Error: Can’t set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
at ServerResponse.header (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/response.js:695:10)

It’s generally due to some callback issue, we are currently reformatting Appium to avoid that in 1.5.

When can we expect 1.5 and what major changes it will have?

Or is there any solution that we can fix something in my code?

Hard to tell without the code.