I'm not sure if this is by design or not. I just noticed it in my last game. If you queue up a building that requires Crystal or Influence or some other such finite resource to be expended upon placing the improvement in the queue, and then later cancel the build, you do not receive a refund on the resource. I assume this is the same case with troops, but have not tested.
If this is by design, it needs to be slightly re-thought. I have no problem with the concept that choosing to build something not be taken lightly. However, you can accidentally screw yourself out of a serious amount of resources, especially if you don't know that you can drag things around in the build queue to re-order them (which is not well documented in-game, and nobody reads manuals these days), and you cancel a few buildings in order to re-queue them in different orders, and such.
If it is intended that you lose the resources for canceling builds, I would suggest that you only lose those resources if you cancel the build after the turn the improvement/troop was placed on the queue. Then you at least get a turn to shuffle things around, change your mind, and finalize. After you hit the turn button, you can only cancel for a loss of resources. Pro-rated resource loss might be a bit difficult to implement, I would think?
Of course, if this is a bug, it needs to be fixed.