While you can store items in your spaceship while playing Starfield, they may end up missing. To see how you can potentially make them appear again, you can take a look at this troubleshooting article from Seeking Tech.
1. If you haven’t done so already, recheck your cargo to see if the items you have been storing on the ship have been relocated.
2. If you previously changed your home ship, then you can try returning to the prior spaceship to see if you can locate your missing inventory.
3. You can try returning to the last instanced area.
4. Try to load up an earlier save file and then check if your items are still stored on your ship.
5. If the items you have stored on your spaceship are still missing, then you can close the game and then restart your PC, Xbox Series X or Xbox Series S.
Keep in mind that you need to quit out of Starfield if you are playing on Xbox before restarting. To do so, open the guide menu by pressing the Xbox button. From there, move the cursor over to the game icon and then press the Menu button. You should open the pop-up menu, where you can then select Quit.
6. Check to see if there is an update available for Starfield as a new patch may make the vanished items on the ship appear.
7. If you have mods installed, then you can try disabling and deleting them.