Common errors

Error: Cannot instantiate interface Magento\Framework\Config\ReaderInterface

Most likely you forgot to enable the module Yireo_LokiComponents and/or the module Yireo_LokiCheckout.

Exception on unknown group

You might bump into an error similar to this:

Exception #0 (RuntimeException): Component "loki-checkout.shipping.address.account_type" refers to unknown group "shippingAddressFields"

Make sure the Yireo_LokiCheckout module is enabled or disable all other LokiCheckout modules as well.

Alpine Expression Error: xyz is not defined

This error pops up most of the time, when an AlpineJS component is lazy-loaded via AJAX. While the HTML-part of the component can be lazy-loaded without issue, the data-part (Alpine.data()) is a problem, because browsers do not execute script-tags loaded via AJAX. This scenario could pop up when creating your own custom LokiComponent but it should not.

When the LokiComponent AJAX call loads different HTML-parts from the server and when this new HTML defines a new AlpineJS component including its Alpine.data() script, then the error message simply tells you that the data could not be loaded. The solution is: Don't do this. Don't lazy-load Alpine.data() via AJAX.

Instead, make sure the script output is actually always loaded (ideally, as part of the container loki-scripts) and switch between the HTML parts by using AlpineJS its x-show.

Failed to read initial data for Loki Component

This is usually caused by an Alpine Component that calls upon LokiComponentType, without that component being an actual Loki Component (defined through etc/loki_components.xml). For instance, if the following JavaScript would just be inserted into the page and somewhere in the HTML, the HTML attribute x-data="Foobar" would be applied, it would result into the error.

Alpine.data('Foobar', () => ({
    ...LokiComponentType,
}));

Just make sure to either create a simple Alpine component that is separate from all Loki component types. Or initialize the block as Loki component with an entry in etc/loki_components.xml.

Last modified: April 30, 2025