So I do my research, and it turns out we were sending weights including the metal of the container itself from the one system, but interpreting them as net weights, so excluding container weight itself. So we were off by about 3000kg per container, which is bad enough if the container is 25000kg total, but even worse when transporting empties, where we were off by 100%.
Thank goodness it is drilled into captains that there are strict limits when it comes to stability, and I have never met a captain who will depart if they are not absolutely positive about the stability of their ship, but man I have spent a good few nights lying awake thinking about what could have happened.
I thought I was just working on some boring logistics software at the time, where the worst that could happen was losing a container for a day or so. It was a rude awakening.