i can reproduce the edit issue in single player mode with no mods.

exchanging the treasure is still limited by the number of slots in the coffer, which has 100 slots. this fills quickly as bars and coins stack to 1,000 by default on vanilla. this is definitely too small and only allows for 3333 bars to be exchanged.

Please ensure stack sizes match the stack sizes available in chests or backpacks… which might change on a modded server.

thanks