The GameInventory.FindFirstFreeLocationForNewEntity(string item_type, FindInventoryLocationType flags, out notnull InventoryLocation loc) method may return an invalid inventory location inside a nested container, even when a valid location is available in the parent container.
The method returns a location inside the AmmoBox cargo, even though a PlateCarrierPouch cannot be placed inside this container. As a result, the method returns an unsuitable location instead of finding an available slot in the backpack containing the AmmoBox.
Since FindFirstFreeLocationForNewEntity() is used internally by CreateInInventory(), this issue affects multiple inventory-related systems and gameplay mechanics that rely on creating entities directly in a character's inventory or inside containers.
As a result, items may fail to spawn in an inventory despite sufficient available space, affecting various aspects of the game that rely on CreateInInventory()
Additional Observation:
The behavior appears to depend on the number of cargo slots and the current inventory state rather than the specific parent container type. For example, when AliceBag_Green is replaced with TortillaBag, the PlateCarrierPouch spawns in the backpack as expected. This suggests that changes in the available cargo space or inventory layout affect which location FindFirstFreeLocationForNewEntity() returns.
The method's location selection behavior is inconsistent: it may return a location inside a nested container where the item cannot be placed, despite sufficient available space in the parent container.