Consent to the use of Personal Data and Cookies

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

Shopware: $kernelClass must be string

How to fix an apparent bug after upgrading to Shopware 6.4.15.x.


Edited: 2022-10-29 09:27

Compile Error: Type of Shopware\Production\HttpKernel::$kernelClass must be string (as in class Shopware\Core\HttpKernel)

This problem seem to happen because of a missing type declaration on line 5 in src/HttpKernel.php, there is also an official patch to fix it. E.g.:

<?php declare(strict_types=1);

namespace Shopware\Production;

class HttpKernel extends \Shopware\Core\HttpKernel
    protected static $kernelClass = Kernel::class;

To fix it, simply add the string type declaration in front of $kernelClass. E.g:

1. To fix the problem from a terminal:

nano +5 /srv/shopware/src/HttpKernel.php

2. Add the missing string type:

protected static string $kernelClass = Kernel::class;

Mismatch in types

The problem prevents you from updating Shopware, but requires only this minor edit to be fixed. It can happen, for example, after upgrading from Shopware to or even

Please note, there are two files that named the same, but placed in different locations – one extending the other, which causes a mismatch with the declared type; so, let us say your Shopware root is /srv/shopware/, the file you need to edit is located here:


This extends the class in core at:


Tell us what you think:


Or simply add the string definition to your overwritten HttpKernel Class

protected static string $kernelClass = Kernel::class;


Thank you so much! Faced this error today and found your solution. Now it works perfectly fine.


Many thanks, I also encountered this problem today and was able to solve it within minutes with your guide/solution! \m/,

  1. Undefined array key password doing installation of Shopware using the web installer.
  2. How SEO URLs work in Shopware, and how to customize them.
  3. How to disable certain Exception error messages in Shopware, so that redundant messages do not show up in the log file.
  4. Running messenger:consume workers with a time limit can be useful, but you should also not set it too low.
  5. If shopware is stuck in maintenance mode, make sure to delete the update fulder and disable maintenance mode manually.

More in: Shopware