If SunEdison enters into bankruptcy, the autopsy will no doubt reveal a suicide, finding the solar energy company done in by financial engineering that was too clever and by a failure of its executives and investment bankers to remember the lessons of the financial crisis.

SunEdison is not dead yet, but it is floundering. The immediate cause of its distress is the now-terminated agreement to acquire Vivint for $2.2 billion that was struck last July.

The highly leveraged deal flashed caution from the start. SunEdison agreed to acquire Vivint Solar, but could not afford to pay the $2.2 billion. Instead, the deal consisted of cash and SunEdison common stock. SunEdison did not have the cash so it arranged to borrow $500 million from Goldman Sachs Bank USA. That was not enough so SunEdison also agreed to issue $350 million in convertible notes to Vivint holders, debt instruments that SunEdison would pay out later at 2.25 percent interest. This type of self-financed debt is the last resort of acquirers.

But it was still not enough. SunEdison had also engaged in a bit of prior financial engineering, creating two “yieldcos.” A yieldco is a bit like a master limited partnership, or M.L.P., and rides the Wall Street trend of trying to disaggregate assets while juicing returns and trying for a bit of tax arbitrage at the same time. In other words, like M.L.P.s that are now piling up as dead carcasses in the oil depression, they probably should not exist in this form. Yieldcos are newly created public companies that purchase energy assets, such as solar generation plants, from a parent company. The parent company then focuses on building these assets and can then offload them to the yieldco. The yieldco will then run the asset with the intent to create a steady stream of dividend payments to holders. And because the yieldco is a corporation and not a partnership, it can attract a wider array of investors.