Request on Column 'mount_id' with 'null' value

Nextcloud version: 18.? (not sure where to find it in the .php-files)
Operating system and version: ? (shared host, no shell access)
Apache or nginx version: Apache (?)
PHP version: 7.2.33

The issue you are facing:
Login to NC not possible, produces only internal server error 500. (log below)
Error first occured on 15/08/2020 21:15 (while running cronjob) and has since flooded the log.
DBAL complainig about NotNullViolation - obviously, table “mount” is requested with mount_id ‘null’:
with params [2, “\/USER\/”, null, “USER”, 6]
But how can that be?
phpmyadmin shows each entry of that table has mount_id=0. Not sure, if this was always like that, have yet to check the old DB-backups.
But which function issued this request?

This appeared out of nowhere. I know, I definitely didn’t work on the instance at that time - wasn’t even at home. Last log-entry before this was two weeks earlier.

By my research so far, I wonder, is the table “mount” from an optional app (external shares like Dropbox, etc - installed this app sometime ago, but didn’t use it, so I could let that go…) or part of the core functions? If it’s optional, maybe I can get rid of it to fix this? But how?
Maybe occ commands via php exec, but which exactly?
Any ideas or solutions?
Couldn’t find prior questions about this - sorry, if I missed something in the forum.
Thanks!

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:
Got no idea.

The output of your Nextcloud log:

{"reqId":"RIxG89ZIdPsPwK97UyvK","level":3,"time":"2020-08-15T21:15:01+00:00","remoteAddr":"IPAddr","user":"--","app":"files","method":"GET","url":"/cloud/cron.php","message":{"Exception":"Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException","Message":"An exception occurred while executing 'UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)' with params [2, \"\\/USER\\/\", null, \"USER\", 6]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mount_id' cannot be null","Code":0,"Trace":[{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":169,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractMySQLDriver","type":"->","args":["An exception occurred while executing 'UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)' with params [2, \"\\/USER\\/\", null, \"USER\", 6]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mount_id' cannot be null",{"errorInfo":["23000",1048,"Column 'mount_id' cannot be null"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":145,"function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOMySql\\Driver"},{"errorInfo":["23000",1048,"Column 'mount_id' cannot be null"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"An exception occurred while executing 'UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)' with params [2, \"\\/USER\\/\", null, \"USER\", 6]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mount_id' cannot be null"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":1063,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOMySql\\Driver"},{"errorInfo":["23000",1048,"Column 'mount_id' cannot be null"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)",{"1":2,"2":"/USER/","3":null,"4":"USER","5":6}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/Connection.php","line":220,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)",[2,"/USER/",null,"USER",6],[2,2,1,2,1]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":203,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = :dcValue1, `mount_point` = :dcValue2, `mount_id` = :dcValue3 WHERE (`user_id` = :dcValue4) AND (`root_id` = :dcValue5)",{"dcValue1":2,"dcValue2":"/USER/","dcValue3":null,"dcValue4":"USER","dcValue5":6},{"dcValue1":2,"dcValue2":2,"dcValue3":1,"dcValue4":2,"dcValue5":1}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":215,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":201,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":145,"function":"updateCachedMount","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/MountProviderCollection.php","line":189,"function":"registerMounts","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":454,"function":"registerMounts","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":377,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/legacy/util.php","line":309,"function":"init","class":"OC\\Files\\Filesystem","type":"::","args":["USER","/USER/files"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":116,"function":"setupFS","class":"OC_Util","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":155,"function":"getMounts","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":83,"function":"backgroundScan","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":111,"function":"runScanner","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[null]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/TimedJob.php","line":55,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/cron.php","line":148,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php","Line":103,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mount_id' cannot be null","Code":"23000","Trace":[{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":1054,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/Connection.php","line":220,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)",[2,"/USER/",null,"USER",6],[2,2,1,2,1]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":203,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = :dcValue1, `mount_point` = :dcValue2, `mount_id` = :dcValue3 WHERE (`user_id` = :dcValue4) AND (`root_id` = :dcValue5)",{"dcValue1":2,"dcValue2":"/USER/","dcValue3":null,"dcValue4":"USER","dcValue5":6},{"dcValue1":2,"dcValue2":2,"dcValue3":1,"dcValue4":2,"dcValue5":1}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":215,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":201,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":145,"function":"updateCachedMount","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/MountProviderCollection.php","line":189,"function":"registerMounts","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":454,"function":"registerMounts","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":377,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/legacy/util.php","line":309,"function":"init","class":"OC\\Files\\Filesystem","type":"::","args":["USER","/USER/files"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":116,"function":"setupFS","class":"OC_Util","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":155,"function":"getMounts","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":83,"function":"backgroundScan","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":111,"function":"runScanner","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[null]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/TimedJob.php","line":55,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/cron.php","line":148,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","Line":119,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mount_id' cannot be null","Code":"23000","Trace":[{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","line":117,"function":"execute","class":"PDOStatement","type":"->","args":[null]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":1054,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/Connection.php","line":220,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = ?, `mount_point` = ?, `mount_id` = ? WHERE (`user_id` = ?) AND (`root_id` = ?)",[2,"/USER/",null,"USER",6],[2,2,1,2,1]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":203,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["UPDATE `oc_mounts` SET `storage_id` = :dcValue1, `mount_point` = :dcValue2, `mount_id` = :dcValue3 WHERE (`user_id` = :dcValue4) AND (`root_id` = :dcValue5)",{"dcValue1":2,"dcValue2":"/USER/","dcValue3":null,"dcValue4":"USER","dcValue5":6},{"dcValue1":2,"dcValue2":2,"dcValue3":1,"dcValue4":2,"dcValue5":1}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":215,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":201,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/UserMountCache.php","line":145,"function":"updateCachedMount","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Config/MountProviderCollection.php","line":189,"function":"registerMounts","class":"OC\\Files\\Config\\UserMountCache","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":454,"function":"registerMounts","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},[{"__class__":"OC\\Files\\Mount\\MountPoint"}]]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Filesystem.php","line":377,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/legacy/util.php","line":309,"function":"init","class":"OC\\Files\\Filesystem","type":"::","args":["USER","/USER/files"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":116,"function":"setupFS","class":"OC_Util","type":"::","args":["USER"]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/Files/Utils/Scanner.php","line":155,"function":"getMounts","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":83,"function":"backgroundScan","class":"OC\\Files\\Utils\\Scanner","type":"->","args":[""]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/apps/files/lib/BackgroundJob/ScanFiles.php","line":111,"function":"runScanner","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Files\\BackgroundJob\\ScanFiles","type":"->","args":[null]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/lib/private/BackgroundJob/TimedJob.php","line":55,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]},{"file":"/var/www/WEBUSER-1/htdocs/cloud/cron.php","line":148,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/WEBUSER-1/htdocs/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","Line":117}},"CustomMessage":"--"},"userAgent":"Wget/1.20.1 (linux-gnu)","version":"18.0.7.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
SECRET
  array (
SECRET  ),
  'datadirectory' => '/var/www/USER/htdocs/cloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.7.1',
  'overwrite.cli.url' => 'DOMAIN',
  'dbname' => 'cloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'SECRET',
  'dbpassword' => 'SECRET',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'SECRET',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'SECRET',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'SECRET',
  'mail_smtppassword' => 'SECRET',
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'occweb',
    2 => 'ownbackup',
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

n/a

Update:
NC is 18.0.7
Changed php to 7.4.9, didn’t help.
NC-notifications in Android-App still working, calendar synchronizing ok.
But still no login possible.