I have now upgraded to v31 and got same errors 
Sending further details.
config:list system
{
"system": {
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "31.0.0.18",
"overwrite.cli.url": "http:\/\/localhost",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"maintenance": false,
"loglevel": 2
}
}
Log error app index
{"reqId":"W8dStA8G1JeMqxbVxR4W","level":3,"time":"2025-03-05T22:18:15+00:00","remoteAddr":"***.***.***.***","user":"admin","app":"index","method":"GET","url":"/index.php/settings/users","message":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/path/to/nextcloud/lib/private/User/Database.php' line 475","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0","version":"31.0.0.18","exception":{"Exception":"Exception","Message":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/path/to/nextcloud/lib/private/User/Database.php' line 475","Code":0,"Trace":[{"file":"/path/to/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/path/to/nextcloud/lib/private/Route/Router.php","line":307,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/path/to/nextcloud/lib/base.php","line":1018,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/path/to/nextcloud/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"TypeError","Message":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned","Code":0,"Trace":[{"file":"/path/to/nextcloud/lib/private/User/Manager.php","line":475,"function":"countUsers","class":"OC\\User\\Database","type":"->"},{"file":"/path/to/nextcloud/apps/settings/lib/Controller/UsersController.php","line":148,"function":"countUsers","class":"OC\\User\\Manager","type":"->"},{"file":"/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"usersList","class":"OCA\\Settings\\Controller\\UsersController","type":"->"},{"file":"/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/path/to/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/path/to/nextcloud/lib/private/Route/Router.php","line":307,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/path/to/nextcloud/lib/base.php","line":1018,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/path/to/nextcloud/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/path/to/nextcloud/lib/private/User/Database.php","Line":475},"message":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/path/to/nextcloud/lib/private/User/Database.php' line 475","exception":[],"CustomMessage":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/path/to/nextcloud/lib/private/User/Database.php' line 475"},"id":"67c8cdc444bf6"}
Log error app core
{"reqId":"KMVgeoqL5Zfk34ohkCab","level":3,"time":"2025-03-05T22:05:31+00:00","remoteAddr":"","user":false,"app":"core","method":"","url":"--","message":"Error while running background job OCA\\Support\\BackgroundJobs\\CheckSubscription (id: 1, arguments: null)","userAgent":"--","version":"31.0.0.18","exception":{"Exception":"TypeError","Message":"OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned","Code":0,"Trace":[{"file":"/path/to/nextcloud/apps/support/lib/Service/SubscriptionService.php","line":78,"function":"countUsers","class":"OC\\User\\Database","type":"->"},{"file":"/path/to/nextcloud/apps/support/lib/Service/SubscriptionService.php","line":232,"function":"getUserCount","class":"OCA\\Support\\Service\\SubscriptionService","type":"->"},{"file":"/path/to/nextcloud/apps/support/lib/Service/SubscriptionService.php","line":294,"function":"getSubscriptionInfo","class":"OCA\\Support\\Service\\SubscriptionService","type":"->"},{"file":"/path/to/nextcloud/apps/support/lib/BackgroundJobs/CheckSubscription.php","line":32,"function":"checkSubscription","class":"OCA\\Support\\Service\\SubscriptionService","type":"->"},{"file":"/path/to/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Support\\BackgroundJobs\\CheckSubscription","type":"->"},{"file":"/path/to/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/path/to/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/path/to/nextcloud/core/Command/Background/JobWorker.php","line":129,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/path/to/nextcloud/3rdparty/symfony/console/Command/Command.php","line":326,"function":"execute","class":"OC\\Core\\Command\\Background\\JobWorker","type":"->"},{"file":"/path/to/nextcloud/core/Command/Base.php","line":161,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/path/to/nextcloud/3rdparty/symfony/console/Application.php","line":1078,"function":"run","class":"OC\\Core\\Command\\Base","type":"->"},{"file":"/path/to/nextcloud/3rdparty/symfony/console/Application.php","line":324,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/path/to/nextcloud/3rdparty/symfony/console/Application.php","line":175,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/path/to/nextcloud/lib/private/Console/Application.php","line":187,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/path/to/nextcloud/console.php","line":87,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/path/to/nextcloud/occ","line":11,"args":["/path/to/nextcloud/console.php"],"function":"require_once"}],"File":"/path/to/nextcloud/lib/private/User/Database.php","Line":475,"message":"Error while running background job OCA\\Support\\BackgroundJobs\\CheckSubscription (id: 1, arguments: null)","exception":[],"CustomMessage":"Error while running background job OCA\\Support\\BackgroundJobs\\CheckSubscription (id: 1, arguments: null)"},"id":"67c8cdce3fcda"}
app:list
Enabled:
- activity: 4.0.0
- app_api: 5.0.2
- bruteforcesettings: 4.0.0
- circles: 31.0.0-dev.0
- cloud_federation_api: 1.14.0
- comments: 1.21.0
- contactsinteraction: 1.12.0
- dashboard: 7.11.0
- dav: 1.33.0
- federatedfilesharing: 1.21.0
- federation: 1.21.0
- files: 2.3.1
- files_downloadlimit: 4.0.0
- files_pdfviewer: 4.0.0
- files_reminders: 1.4.0
- files_sharing: 1.23.1
- files_trashbin: 1.21.0
- files_versions: 1.24.0
- firstrunwizard: 4.0.0
- logreader: 4.0.0
- lookup_server_connector: 1.19.0
- nextcloud_announcements: 3.0.0
- notifications: 4.0.0
- oauth2: 1.19.1
- password_policy: 3.0.0
- photos: 4.0.0-dev.1
- privacy: 3.0.0
- profile: 1.0.0
- provisioning_api: 1.21.0
- recommendations: 4.0.0
- related_resources: 2.0.0
- serverinfo: 3.0.0
- settings: 1.14.0
- sharebymail: 1.21.0
- support: 3.0.0
- survey_client: 3.0.0
- systemtags: 1.21.1
- text: 5.0.0
- theming: 2.6.1
- twofactor_backupcodes: 1.20.0
- updatenotification: 1.21.0
- user_status: 1.11.0
- viewer: 4.0.0
- weather_status: 1.11.0
- webhook_listeners: 1.2.0
- workflowengine: 2.13.0
Disabled:
- admin_audit: 1.21.0
- encryption: 2.19.0
- files_external: 1.23.0
- suspicious_login: 9.0.1
- twofactor_nextcloud_notification: 5.0.0
- twofactor_totp: 13.0.0-dev.0
- user_ldap: 1.22.0
Any ideas 