Nextcloud 10 logging "no app in context" and "Backends provided no user object for .." error against sharedstorage.php

Support intro

I get three of these logged to /var/log/messages every 15 minutes (coincides with cron.php runs). ([slightly redacted])

ownCloud[PID]: {no app in context} Exception: {"Exception":"OC\\User\\NoUserException","Message":"Backends provided no user object for [username]","Code":0,"Trace":"#0 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(98)

Nextcloud version (eg, 12.0.2): 10.0.4 (EPEL RPM nextcloud-10.0.4-2.el7)
Operating system and version (eg, Ubuntu 17.04): CentOS 7
Apache or nginx version (eg, Apache 2.4.25): Apache (httpd-2.4.6-67.el7)
PHP version (eg, 7.1): 5.4.16 (php-5.4.16-43.el7_4.1))

The issue you are facing:

Strange log entries every 15 minutes. The three accounts in question are all SAML but we have lots of other SAML accounts that aren’t showing this entry.

Log entry timing coincides precisely with the cron call to /usr/share/nextcloud/cron.php

One entire log entry [slightly redacted]:

Mar 27 11:00:02 [hostname] ownCloud[PID]: {no app in context} Exception: {"Exception":"OC\\User\\NoUserException","Message":"Backends provided no user object for [username]","Code":0,"Trace":"#0 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(98): OC\\Files\\Filesystem::initMountPoints('[usename]')\n#1 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(433): OC\\Files\\Storage\\Shared->init()\n#2 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(486): OC\\Files\\Storage\\Shared->getWrapperStorage()\n#3 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(123): OC\\Files\\Storage\\Wrapper\\Wrapper->instanceOfStorage('\\OC\\Files\\Stora...')\n#4 \/usr\/share\/nextcloud\/lib\/private\/legacy\/util.php(149): OC\\Files\\Storage\\Shared->instanceOfStorage('\\OC\\Files\\Stora...')\n#5 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/StorageFactory.php(101): OC_Util::{closure}('\/[otherusername1]\/files\/...', Object(OC\\Files\\Storage\\Shared), Object(OCA\\Files_Sharing\\SharedMount))\n#6 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(146): OC\\Files\\Storage\\StorageFactory->wrap(Object(OCA\\Files_Sharing\\SharedMount), Object(OC\\Files\\Storage\\Shared))\n#7 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(170): OC\\Files\\Mount\\MountPoint->createStorage()\n#8 \/usr\/share\/nextcloud\/lib\/private\/Files\/View.php(1689): OC\\Files\\Mount\\MountPoint->getStorage()\n#9 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(99): OC\\Files\\View->getPath(9604)\n#10 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(433): OC\\Files\\Storage\\Shared->init()\n#11 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(486): OC\\Files\\Storage\\Shared->getWrapperStorage()\n#12 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(123): OC\\Files\\Storage\\Wrapper\\Wrapper->instanceOfStorage('\\OC\\Files\\Stora...')\n#13 \/usr\/share\/nextcloud\/lib\/private\/legacy\/util.php(149): OC\\Files\\Storage\\Shared->instanceOfStorage('\\OC\\Files\\Stora...')\n#14 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/StorageFactory.php(101): OC_Util::{closure}('\/lvd\/files\/sdfo...', Object(OC\\Files\\Storage\\Shared), Object(OCA\\Files_Sharing\\SharedMount))\n#15 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(146): OC\\Files\\Storage\\StorageFactory->wrap(Object(OCA\\Files_Sharing\\SharedMount), Object(OC\\Files\\Storage\\Shared))\n#16 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(170): OC\\Files\\Mount\\MountPoint->createStorage()\n#17 \/usr\/share\/nextcloud\/lib\/private\/Files\/Utils\/Scanner.php(121): OC\\Files\\Mount\\MountPoint->getStorage()\n#18 \/usr\/share\/nextcloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(88): OC\\Files\\Utils\\Scanner->backgroundScan('')\n#19 \/usr\/share\/nextcloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(112): OCA\\Files\\BackgroundJob\\ScanFiles->runScanner(Object(OC\\User\\User))\n#20 \/usr\/share\/nextcloud\/lib\/private\/BackgroundJob\/Job.php(53): OCA\\Files\\BackgroundJob\\ScanFiles->run(NULL)\n#21 \/usr\/share\/nextcloud\/lib\/private\/BackgroundJob\/TimedJob.php(54): OC\\BackgroundJob\\Job->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#22 \/usr\/share\/nextcloud\/cron.php(122): OC\\BackgroundJob\\TimedJob->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#23 {main}","File":"\/usr\/share\/nextcloud\/lib\/private\/Files\/Filesystem.php","Line":409}

Mar 27 11:00:02 [hostname] ownCloud[PID]: {no app in context} Exception: {"Exception":"OC\\User\\NoUserException","Message":"Backends provided no user object for [username]","Code":0,"Trace":"#0 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(98): OC\\Files\\Filesystem::initMountPoints('jeco')\n#1 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(433): OC\\Files\\Storage\\Shared->init()\n#2 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(486): OC\\Files\\Storage\\Shared->getWrapperStorage()\n#3 \/usr\/share\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(123): OC\\Files\\Storage\\Wrapper\\Wrapper->instanceOfStorage('\\OC\\Files\\Stora...')\n#4 \/usr\/share\/nextcloud\/lib\/private\/legacy\/util.php(149): OC\\Files\\Storage\\Shared->instanceOfStorage('\\OC\\Files\\Stora...')\n#5 \/usr\/share\/nextcloud\/lib\/private\/Files\/Storage\/StorageFactory.php(101): OC_Util::{closure}('\/sdaniel\/files\/...', Object(OC\\Files\\Storage\\Shared), Object(OCA\\Files_Sharing\\SharedMount))\n#6 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(146): OC\\Files\\Storage\\StorageFactory->wrap(Object(OCA\\Files_Sharing\\SharedMount), Object(OC\\Files\\Storage\\Shared))\n#7 \/usr\/share\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(170): OC\\Files\\Mount\\MountPoint->createStorage()\n#8 \/usr\/share\/nextcloud\/lib\/private\/Files\/Utils\/Scanner.php(121): OC\\Files\\Mount\\MountPoint->getStorage()\n#9 \/usr\/share\/nextcloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(88): OC\\Files\\Utils\\Scanner->backgroundScan('')\n#10 \/usr\/share\/nextcloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(112): OCA\\Files\\BackgroundJob\\ScanFiles->runScanner(Object(OC\\User\\User))\n#11 \/usr\/share\/nextcloud\/lib\/private\/BackgroundJob\/Job.php(53): OCA\\Files\\BackgroundJob\\ScanFiles->run(NULL)\n#12 \/usr\/share\/nextcloud\/lib\/private\/BackgroundJob\/TimedJob.php(54): OC\\BackgroundJob\\Job->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#13 \/usr\/share\/nextcloud\/cron.php(122): OC\\BackgroundJob\\TimedJob->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#14 {main}","File":"\/usr\/share\/nextcloud\/lib\/private\/Files\/Filesystem.php","Line":409}

Is this the first time you’ve seen this error? (Y/N): y (first time I’ve noticed it.)

Steps to replicate it:

  1. unsure

The output of your Nextcloud log in Admin > Logging:

empty, logging to syslog. See above snippet for log output.

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

$CONFIG = array (
  'log_type' => 'syslog',
  'datadirectory' => '/var/lib/nextcloud/data',
  'updatechecker' => false,
  'check_for_working_htaccess' => false,
  'asset-pipeline.enabled' => false,
  'assetdirectory' => '/var/lib/nextcloud',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/share/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/lib/nextcloud/apps',
      'url' => '/apps-appstore',
      'writable' => true,
    ),
  ),
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' =>
  array (
    0 => 'redacted',
    1 => 'redacted',
  ),
  'overwrite.cli.url' => 'https://redacted/nextcloud',
  'dbtype' => 'mysql',
  'version' => '9.1.4.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'redacted',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'redacted',
  'dbpassword' => 'redacted',
  'logtimezone' => 'UTC',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_domain' => 'redacted',
  'mail_from_address' => 'redacted',
  'mail_smtpmode' => 'php',
);

The output of your Apache/nginx/system log in /var/log/____:
This is pretty much a sure bet to be related to something in /usr/share/nextcloud/cron.php.
error_log shows a happy start up and nothing more
ssl_error_log shows invalid access attempts for .env and .git from random crackers and nothing more.

Is this a new error? Please note that NC 10 is not supported any more (https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule). I would first try it with a current version, perhaps this issue has already been fixed. Please note that you need a newer php version for newer Nextcloud versions. If you absolutely need support for NC10, you can consult enterprise support, they provide up to 10 years.