I'm using Magento 2.4.3 and have sold an item, but when I go to ship it, I get this error "Following products with requested skus were not found: Prod-P1234".
The product exists with that SKU, and the stock levels indicate Quantity 1, Salable Quantity 0. The inventory_reservation database table has an entry for this item with a -1 quantity. There are no spaces either side of the sku.
I've tried re-saving the product with a higher quantity in stock in case that was the issue, as well as using the indexer:reindex command.
The product was Migrated from Magento 1.9 originally, so that may be a factor, but this is the first time in over a year that this message has occurred.
Any ideas why it can't find the SKU or things to check?
I've had a look at the file where the exception is triggered from (\vendor\magento\module-inventory-catalog\Model\GetProductIdsBySkus.php) to compare the skus being passed into it against those in the products table, and for some reason the invoiced product SKU has an extra spacebar on the end, where as the product its self does not.
I've spoken to my client (the Magento 2 site owner) who has said they originally tried to save the product sku with a space on the end, but Magento wouldn't allow it, so they removed the space and it then saved.
I've found an old database from Magento 1 and the product SKU had a space on the end originally, which has now gone in Magento 2. It looks like Magento 2 stripped the space off the end, but didn't update the table inventory_source_item which still listed the sku with a space.