You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Negative cargo race condition bug in transfer cargo #110
I have a bugged ship, it fails to fetch on both the ships listing and single ship endpoints. Here is the returned error:
{"error":{"code":3000,"message":"The server did not return a valid response. If you want to help you can file an issue here: https://github.com/SpaceTradersAPI/api-docs.","requestId":"019790c7-bd34-71e9-b907-36ed2e4c82c6"}}
It's ship RJ45-22 in the current reset (2025-06-15). It's a mining drone.
I have had this happen on both the prod and staging servers.
There's a chance it's a race condition in the cargo transfer code 'cause my client used to not be super careful to ensure that the cargo of the ship it's transferring to was not full, and I had several agents all transferring at the same time, which could result in two transfer cargo requests at the same time to the server for different ships to both fill the target ship (which was a hauler).
I have since changed my logic so the hauler pulls cargo from the drones rather than the drones pushing to it so if I am right it shouldn't happen again. But I will report if that's not the case.
edit: the /cargo endpoint fails, but the /nav endpoint succeeds. So a bit more evidence that the cargo transfer is the issue.
Just so you know, it happened again this reset. Same issue, my miners somehow managed to get -4 water ice. It was basically a race condition between one ship (in one process) jettisoning the water ice, and another ship (in another process) trying to transfer it. I am guessing they hit the server at the same time resulting in both of them succeeding, but one ending up with negative water ice in its cargo hold.
Activity
rj45 commentedon Jun 29, 2025
Just so you know, it happened again this reset. Same issue, my miners somehow managed to get -4 water ice. It was basically a race condition between one ship (in one process) jettisoning the water ice, and another ship (in another process) trying to transfer it. I am guessing they hit the server at the same time resulting in both of them succeeding, but one ending up with negative water ice in its cargo hold.
[-]Bugged ship, happens on prod and on staging[/-][+]Negative cargo race condition bug in transfer cargo[/+]