Undefined class constant 'MAJOR_VERSION' after upgrade to 21

Hi,

I just updated my nextcloud docker instance to a newer version. However, now when I want to access the settings, files or contacts, I get an error page. The calender works fine.

Nextcloud version (eg, 20.0.5): 21.0.0.18. Upgraded from 20.0.5

Here is an example output of one request thats causing an error (taken form nextcloud.log):

{
    "reqId":"WVEnl7uVfL2hPXlH1hTt",
    "level":3,
    "time":"2021-02-23T07:13:45+00:00",
    "remoteAddr":"172.18.0.8",
    "user":"leon",
    "app":"index",
    "method":"GET",
    "url":"/index.php/settings/user",
    "message":{
        "Exception":"Exception",
        "Message":"Undefined class constant 'MAJOR_VERSION'",
        "Code":0,
        "Trace":[
            {
                "file":"/var/www/html/lib/private/AppFramework/App.php",
                "line":157,
                "function":"dispatch",
                "class":"OC\\AppFramework\\Http\\Dispatcher",
                "type":"->",
                "args":[
                    {
                        "__class__":"OCA\\Settings\\Controller\\PersonalSettingsController"
                    },
                    "index"
                ]
            },
            {
                "file":"/var/www/html/lib/private/Route/Router.php",
                "line":302,
                "function":"main",
                "class":"OC\\AppFramework\\App",
                "type":"::",
                "args":[
                    "OCA\\Settings\\Controller\\PersonalSettingsController",
                    "index",
                    {
                        "__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"
                    },
                    {
                        "section":"personal-info",
                        "_route":"settings.PersonalSettings.index"
                    }
                ]
            },
            {
                "file":"/var/www/html/lib/base.php",
                "line":993,
                "function":"match",
                "class":"OC\\Route\\Router",
                "type":"->",
                "args":[
                    "/settings/user"
                ]
            },
            {
                "file":"/var/www/html/index.php",
                "line":37,
                "function":"handleRequest",
                "class":"OC",
                "type":"::",
                "args":[
                    
                ]
            }
        ],
        "File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "Line":159,
        "Previous":{
            "Exception":"Error",
            "Message":"Undefined class constant 'MAJOR_VERSION'",
            "Code":0,
            "Trace":[
                {
                    "file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/functions.php",
                    "line":71,
                    "function":"defaultUserAgent",
                    "class":"GuzzleHttp\\Utils",
                    "type":"::",
                    "args":[
                        
                    ]
                },
                {
                    "file":"/var/www/html/custom_apps/files_external_gdrive/vendor/guzzlehttp/guzzle/src/Client.php",
                    "line":194,
                    "function":"GuzzleHttp\\default_user_agent",
                    "args":[
                        
                    ]
                },
                {
                    "file":"/var/www/html/custom_apps/files_external_gdrive/vendor/guzzlehttp/guzzle/src/Client.php",
                    "line":75,
                    "function":"configureDefaults",
                    "class":"GuzzleHttp\\Client",
                    "type":"->",
                    "args":[
                        {
                            "handler":{
                                "__class__":"GuzzleHttp\\HandlerStack"
                            }
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Http/Client/ClientService.php",
                    "line":62,
                    "function":"__construct",
                    "class":"GuzzleHttp\\Client",
                    "type":"->",
                    "args":[
                        
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/OCS/DiscoveryService.php",
                    "line":55,
                    "function":"newClient",
                    "class":"OC\\Http\\Client\\ClientService",
                    "type":"->",
                    "args":[
                        
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Server.php",
                    "line":1251,
                    "function":"__construct",
                    "class":"OC\\OCS\\DiscoveryService",
                    "type":"->",
                    "args":[
                        {
                            "__class__":"OC\\Memcache\\Factory"
                        },
                        {
                            "__class__":"OC\\Http\\Client\\ClientService"
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":155,
                    "function":"OC\\{closure}",
                    "class":"OC\\Server",
                    "type":"->",
                    "args":[
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file":"/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php",
                    "line":118,
                    "function":"OC\\AppFramework\\Utility\\{closure}",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":122,
                    "function":"offsetGet",
                    "class":"Pimple\\Container",
                    "type":"->",
                    "args":[
                        "OCP\\OCS\\IDiscoveryService"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/ServerContainer.php",
                    "line":137,
                    "function":"query",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCP\\OCS\\IDiscoveryService",
                        false
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":434,
                    "function":"query",
                    "class":"OC\\ServerContainer",
                    "type":"->",
                    "args":[
                        "OCP\\OCS\\IDiscoveryService",
                        true
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":87,
                    "function":"query",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCP\\OCS\\IDiscoveryService",
                        true
                    ]
                },
                {
                    "function":"OC\\AppFramework\\Utility\\{closure}",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":101,
                    "function":"array_map",
                    "args":[
                        {
                            "__class__":"Closure"
                        },
                        [
                            {
                                "name":"addressHandler",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"httpClientService",
                                "__class__":"ReflectionParameter"
                            },
                            "*** sensitive parameter replaced ***",
                            {
                                "name":"jobList",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"federationProviderManager",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"cloudFederationFactory",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"eventDispatcher",
                                "__class__":"ReflectionParameter"
                            }
                        ]
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":109,
                    "function":"buildClass",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        {
                            "name":"OCA\\FederatedFileSharing\\Notifications",
                            "__class__":"ReflectionClass"
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":126,
                    "function":"resolve",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Notifications"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":459,
                    "function":"query",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Notifications"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":431,
                    "function":"queryNoFallback",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Notifications"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":87,
                    "function":"query",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Notifications",
                        true
                    ]
                },
                {
                    "function":"OC\\AppFramework\\Utility\\{closure}",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":101,
                    "function":"array_map",
                    "args":[
                        {
                            "__class__":"Closure"
                        },
                        [
                            {
                                "name":"connection",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"addressHandler",
                                "__class__":"ReflectionParameter"
                            },
                            "*** sensitive parameter replaced ***",
                            {
                                "name":"tokenHandler",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"l10n",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"logger",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"rootFolder",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"config",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"userManager",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"cloudIdManager",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"globalScaleConfig",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"cloudFederationProviderManager",
                                "__class__":"ReflectionParameter"
                            }
                        ]
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":109,
                    "function":"buildClass",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        {
                            "name":"OCA\\FederatedFileSharing\\FederatedShareProvider",
                            "__class__":"ReflectionClass"
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":126,
                    "function":"resolve",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\FederatedShareProvider"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":459,
                    "function":"query",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\FederatedShareProvider"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":431,
                    "function":"queryNoFallback",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\FederatedShareProvider"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":87,
                    "function":"query",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\FederatedShareProvider",
                        true
                    ]
                },
                {
                    "function":"OC\\AppFramework\\Utility\\{closure}",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":101,
                    "function":"array_map",
                    "args":[
                        {
                            "__class__":"Closure"
                        },
                        [
                            "*** sensitive parameter replaced ***",
                            {
                                "name":"userSession",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"l",
                                "__class__":"ReflectionParameter"
                            },
                            {
                                "name":"defaults",
                                "__class__":"ReflectionParameter"
                            }
                        ]
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":109,
                    "function":"buildClass",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        {
                            "name":"OCA\\FederatedFileSharing\\Settings\\Personal",
                            "__class__":"ReflectionClass"
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
                    "line":126,
                    "function":"resolve",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Settings\\Personal"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                    "line":459,
                    "function":"query",
                    "class":"OC\\AppFramework\\Utility\\SimpleContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Settings\\Personal"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/ServerContainer.php",
                    "line":146,
                    "function":"queryNoFallback",
                    "class":"OC\\AppFramework\\DependencyInjection\\DIContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Settings\\Personal"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Settings/Manager.php",
                    "line":171,
                    "function":"query",
                    "class":"OC\\ServerContainer",
                    "type":"->",
                    "args":[
                        "OCA\\FederatedFileSharing\\Settings\\Personal"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Settings/Manager.php",
                    "line":299,
                    "function":"getSettings",
                    "class":"OC\\Settings\\Manager",
                    "type":"->",
                    "args":[
                        "personal",
                        "additional"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Settings/Manager.php",
                    "line":260,
                    "function":"getPersonalSettings",
                    "class":"OC\\Settings\\Manager",
                    "type":"->",
                    "args":[
                        "additional"
                    ]
                },
                {
                    "file":"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",
                    "line":116,
                    "function":"getPersonalSections",
                    "class":"OC\\Settings\\Manager",
                    "type":"->",
                    "args":[
                        
                    ]
                },
                {
                    "file":"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",
                    "line":64,
                    "function":"formatPersonalSections",
                    "class":"OCA\\Settings\\Controller\\PersonalSettingsController",
                    "type":"->",
                    "args":[
                        "personal",
                        "personal-info"
                    ]
                },
                {
                    "file":"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",
                    "line":148,
                    "function":"getNavigationParameters",
                    "class":"OCA\\Settings\\Controller\\PersonalSettingsController",
                    "type":"->",
                    "args":[
                        "personal",
                        "personal-info"
                    ]
                },
                {
                    "file":"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",
                    "line":68,
                    "function":"getIndexResponse",
                    "class":"OCA\\Settings\\Controller\\PersonalSettingsController",
                    "type":"->",
                    "args":[
                        "personal",
                        "personal-info"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                    "line":218,
                    "function":"index",
                    "class":"OCA\\Settings\\Controller\\PersonalSettingsController",
                    "type":"->",
                    "args":[
                        "personal-info"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                    "line":127,
                    "function":"executeController",
                    "class":"OC\\AppFramework\\Http\\Dispatcher",
                    "type":"->",
                    "args":[
                        {
                            "__class__":"OCA\\Settings\\Controller\\PersonalSettingsController"
                        },
                        "index"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/AppFramework/App.php",
                    "line":157,
                    "function":"dispatch",
                    "class":"OC\\AppFramework\\Http\\Dispatcher",
                    "type":"->",
                    "args":[
                        {
                            "__class__":"OCA\\Settings\\Controller\\PersonalSettingsController"
                        },
                        "index"
                    ]
                },
                {
                    "file":"/var/www/html/lib/private/Route/Router.php",
                    "line":302,
                    "function":"main",
                    "class":"OC\\AppFramework\\App",
                    "type":"::",
                    "args":[
                        "OCA\\Settings\\Controller\\PersonalSettingsController",
                        "index",
                        {
                            "__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"
                        },
                        {
                            "section":"personal-info",
                            "_route":"settings.PersonalSettings.index"
                        }
                    ]
                },
                {
                    "file":"/var/www/html/lib/base.php",
                    "line":993,
                    "function":"match",
                    "class":"OC\\Route\\Router",
                    "type":"->",
                    "args":[
                        "/settings/user"
                    ]
                },
                {
                    "file":"/var/www/html/index.php",
                    "line":37,
                    "function":"handleRequest",
                    "class":"OC",
                    "type":"::",
                    "args":[
                        
                    ]
                }
            ],
            "File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Utils.php",
            "Line":118
        },
        "CustomMessage":"--"
    },
    "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0",
    "version":"21.0.0.18"
}

config.php:

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'redis',
    'port' => 6379,
  ),
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'id',
  'passwordsalt' => 'salt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => 'domain1',
    1 => 'domain2',
  ),
  'datadirectory' => '/var/www/html/data',
  'overwrite.cli.url' => 'domain1',
  'dbtype' => 'mysql',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'version' => '21.0.0.18',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '587',
  'mail_from_address' => 'mail',
  'mail_domain' => 'domain',
  'app_install_overwrite' =>
  array (
    0 => 'socialsharing_email',
    1 => 'checksum',
    2 => 'calendar',
    3 => 'camerarawpreviews',
    4 => 'sendent',
    5 => 'files_external_gdrive',
  ),
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'mail@domain',
  'mail_smtppassword' => 'password',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'domain',
  'mail_smtpsecure' => 'tls',
);

With the help of Upgrade issue v20 -> v21: OCC no longer works because of Undefined class constant 'MAJOR_VERSION' in /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Utils.php:118 路 Issue #1834 路 nextcloud/vm 路 GitHub I fixed the error by removing the apps files_external_gdrive, sendent, camerarawpreviews and checksum from the hard drive and from the config.php. Now it works