Sometimes a Trade Cart or Trade Cog gets moved with other units which makes it go idle. If it has gold in it, it gets lost when you click to ally’s market. So, you need to check if it has gold or not and send to either your market or ally’s. If you sent it to your market, it goes idle again after reaching there.
This can be helped by introducing a “Resume Trade” Quality of life feature. It would be available for each idle trade cart/cog. It will make the cart/cog resume their trade route.