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


Edited: 2022-10-01 20:03

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

This problem seems 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;

  1. If shopware is stuck in maintenance mode, make sure to delete the update fulder and disable maintenance mode manually.
  2. Typical causes and solutions for the No alive nodes found in your cluster error with Elasticsearch.
  3. How you may be able to safely downgrade your Shopware installation in case you accidentally updated.
  4. How to disable certain Exception error messages in Shopware, so that redundant messages do not show up in the log file.

More in: Shopware