Enterprise (Deeside Food Hub) uses the inventory to edit the price and stock levels of items supplied to them.
Updating price and stock levels via the inventory for this enterprise is no longer working.
For Deeside Food Hub:

bug S2
one user effected at the moment.
@lin-d-hop advised this is bug level S1.
Dev notes
I had a quick look at this one but there's not much to go on. It looks like the submitted form did not update the record in this case due to a 401 _unauthorized_ response (see screenshot). So... at the time the form was submitted, the user was not deemed (via cancan) to have the permissions to update the variant override. The result is that there was no _error_ that was actually thrown anywhere, and so no error logs to investigate, either on the server or in Bugsnag.
It seems like this could not be replicated elsewhere (with other user accounts), eg the bug is not universal.
I'm thinking this is maybe an obscure edge case. Possible explanations:
Deeside Food Hub (producer hub) set up:
testing different things:
removed permissions between From Bakery Lane and Deeside and then reinstated them. No change: error message still occurs and unable to update inventory.
Removed manager of Deeside from managers list of From Bakery Lane. Made no change: same permissions error occurred and unable to update the inventory.
Manager of Deeside has reported that her producers are having problems creating products today (they are encountering the slug 'We are sorry but something has gone wrong page').
She also reported that a new user encountered the same screen when trying to log in to OFN.
I have logged in as a producer of her hub and tested both scenarios but didn;t get the same screen
Slug on product creation is always #4959. Unrelated.
Similarly new user will be unrelated.
@Matt-Yorkley Thanks for looking into this. Your notes above did not help resolve this issue. The problem persists and currently this user's business model and processes are broken because they cannot update inventory.
If this is an unsolveable edge case UK support needs to know so we can have a go at create a whole other enterprise and seeing if that resolves the problem. That or we tell the user to change how they run their business.
Would be great to know how to progress. Thanks team.
I tried to reproduce this error in staging-UK. I don't think this is really it, but maybe related.
Having these permissions set:

And having added the product "Lettuce" to the Inventory of Distributor Melon Farm:
Session 1 - while editing Inventory page (Melon Farm)
Session 2 - The Hacienda removes its "add products to inventory" permission
Session 1 - Melon Farm edits Lettuce (price, stock, etc.). Clicking in Update will display the same error as the one shown on the issue above:

I've tried to combine this error with inventory import but found nothing else other than this edge case.
This 401 error did not show up on Bugsnag... Maybe an approach would be to tag this type of error on Bugsnag, so we could have more context?
This should now be resolved. I was able to reproduce the error and figured out that it was because there was a VariantOverride that was tied to the hub, but the hub did not have permissions to manage inventory for the Enterprise that the VariantOverride belonged to.
I set the permission_revoked_at field on the VariantOverride to Time.now and now the inventory is editable again.
My theory is that at some point the Enterprise granted permissions to the hub to manage its inventory and later revoked them. We have a before_destroy callback in EnterpriseRelationship that should revoke permissions for the VariantOverrides when this happens, but it looks like it didn't run here.
I looked at the logs on the UK server to see if I could find a request to delete the EnterpriseRelationship but unfortunately there aren't any params that are sent with a delete request besides the ID. I might have some time later to download an old copy of the database and try to confirm the theory.
I tested on the OFN UK demo hub:
It appears that the issue which resulted when permissions between Deeside Food Hub and The Deesidedly Tasty Company Ltd were revoked is not a wide spread bug, which is good :-)
Thanks Andy for your work on this
Most helpful comment
This should now be resolved. I was able to reproduce the error and figured out that it was because there was a
VariantOverridethat was tied to the hub, but the hub did not have permissions to manage inventory for theEnterprisethat theVariantOverridebelonged to.I set the
permission_revoked_atfield on the VariantOverride toTime.nowand now the inventory is editable again.My theory is that at some point the
Enterprisegranted permissions to the hub to manage its inventory and later revoked them. We have abefore_destroycallback inEnterpriseRelationshipthat should revoke permissions for theVariantOverrides when this happens, but it looks like it didn't run here.I looked at the logs on the UK server to see if I could find a request to delete the
EnterpriseRelationshipbut unfortunately there aren't any params that are sent with a delete request besides the ID. I might have some time later to download an old copy of the database and try to confirm the theory.