Zero-cost buy transactions can occur when you have balance remaining issues. If a sale of an asset makes your overall balance negative this is an error state. An example:
Buy 1 Bitcoin at $5,000
Sell 2 Bitcoin at $6,000
At point 2, we would be negative 1 BTC. The first Bitcoin would be sold for $1,000 profit, but the second Bitcoin sale cannot really happen, since you don't own the asset. To handle this error, we assume a zero-cost purchase of the second Bitcoin. In this example, it would trigger a capital gain of $6,000, with a total capital gain on the transaction of $7,000.
To fix it you will need to fix your balance remaining warnings. In the above case, you would need to enter the missing purchase of BTC. This would correct the capital gains based on the purchase price of both Bitcoins.
You can read more about how to fix the balance remaining errors here.