Search code examples
shopwareshopware6

Shopware 6 Error: Provided language is not in list of available languages. What is the cause and how can i solve it?


While trying to save a new customer i get this error in my dev.log

Uncaught PHP Exception RuntimeException: "Provided language 2fbb5fe2e29a4d70aa5854ce7ce3e20b is not in list of available languages: " at /home/schcmjkg/staging/vendor/shopware/core/System/SalesChannel/Context/BaseContextFactory.php line 329 {"exception":"[object] (RuntimeException(code: 0): Provided language 2fbb5fe2e29a4d70aa5854ce7ce3e20b is not in list of available languages: at /home/schcmjkg/staging/vendor/shopware/core/System/SalesChannel/Context/BaseContextFactory.php:329)"} []

But the issue is that i have not changed the language at all and i cannot even change it because there are no translatable fields -> Screenshot

While trying to save the admin panel tells me that it was unable to save the customer but the customer actually get saved. The event "customer.written" is never triggered, it is only triggered after editing the customer.

So what is the cause and how can i solve it? thank you very much.


Solution

  • I was able to reproduce this error. Seemingly "Deutsch" is your default language, which it reverts to since there are no translatable fields, as the tooltip states. I assume you're trying to save a customer assigned to a sales channel that doesn't include "Deutsch" in its languages. That's how I was able to reproduce it. You can get around that for now by additionally assigning "Deutsch" to the languages of the sales channel. There shouldn't be a language switch in the storefront as long as you don't define a domain using the language, so it shouldn't come with undesired side effects. At least then you should be able to save customer assigned to that sales channel without that exception being thrown. Eventually this undesirable behavior will be fixed though.