User cannot view files: Call to a member function getCache() on null at <<closure>>

Nextcloud version: 16.0.0
Operating system and version: ubuntu 16.04
Apache version: apache 2.4.18
PHP version: 7.2

The issue you are facing:

When my user opens the files tab on Nextcloud I receive the following error message:

“This directory is unavailable, please check the logs or contact the administrator”

My user is also administrator and sees this error in the security & setup warnings:

" Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken"

The other admin account does not receive this error

The output of your Nextcloud log in Admin > Logging:

[index] Error: Error: Call to a member function getCache() on null at <<closure>>

 0. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 382
    OCA\Files_Sharing\SharedStorage->getSourceRootInfo()
 1. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 393
    OCA\Files_Sharing\SharedStorage->getCache("", OCA\Files_Trashb ... l})
 2. /var/www/nextcloud/lib/private/Files/View.php line 1726
    OC\Files\Storage\Wrapper\Wrapper->getCache()
 3. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 128
    OC\Files\View->getPath(219317)
 4. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 477
    OCA\Files_Sharing\SharedStorage->init()
 5. <<closure>>
    OCA\Files_Sharing\SharedStorage->getSourceStorage()
 6. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 506
    undefinedundefinedcall_user_func_array([OCA\Files_Shari ... "], "*** sensitive parameter replaced ***")
 7. /var/www/nextcloud/apps/files_sharing/lib/Cache.php line 93
    OC\Files\Storage\Wrapper\Wrapper->__call("getSourceStorage", "*** sensitive parameter replaced ***")
 8. /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php line 321
    OCA\Files_Sharing\Cache->getCache()
 9. /var/www/nextcloud/lib/private/Files/View.php line 1727
    OC\Files\Cache\Wrapper\CacheJail->getPathById(198450)
10. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 128
    OC\Files\View->getPath(198450)
11. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 112
    OCA\Files_Sharing\SharedStorage->init()
12. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 382
    OCA\Files_Sharing\SharedStorage->getSourceRootInfo()
13. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 393
    OCA\Files_Sharing\SharedStorage->getCache("", OCA\Files_Trashb ... l})
14. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 374
    OC\Files\Storage\Wrapper\Wrapper->getCache()
15. <<closure>>
    OC\Files\Node\Folder->OC\Files\Node\{closure}("*** sensitive parameters replaced ***")
16. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 375
    undefinedundefinedarray_map(Closure {}, [OCA\Files_Exter ... }])
17. /var/www/nextcloud/apps/recommendations/lib/Service/RecentlyEditedFilesSource.php line 60
    OC\Files\Node\Folder->getRecent(6)
18. /var/www/nextcloud/apps/recommendations/lib/Service/RecommendationService.php line 91
    OCA\Recommendations\Service\RecentlyEditedFilesSource->getMostRecentRecommendation(OC\User\User {}, 6)
19. <<closure>>
    OCA\Recommendations\Service\RecommendationService->OCA\Recommendations\Service\{closure}("*** sensitive parameters replaced ***")
20. /var/www/nextcloud/apps/recommendations/lib/Service/RecommendationService.php line 92
    undefinedundefinedarray_reduce([OCA\Recommendat ... }], Closure {}, "*** sensitive parameter replaced ***")
21. /var/www/nextcloud/apps/recommendations/lib/Controller/RecommendationController.php line 63
    OCA\Recommendations\Service\RecommendationService->getRecommendations(OC\User\User {})
22. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 166
    OCA\Recommendations\Controller\RecommendationController->index()
23. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Recommendati ... {}, "index")
24. /var/www/nextcloud/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Recommendati ... {}, "index")
25. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Recommenda ... r", "index", OC\AppFramework\ ... {}, {_route: "recomm ... "})
26. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({_route: "recomm ... "})
27. /var/www/nextcloud/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {_route: "recomm ... "})
28. /var/www/nextcloud/lib/base.php line 975
    OC\Route\Router->match("/apps/recommend ... s")
29. /var/www/nextcloud/index.php line 42
    OC::handleRequest()

GET /apps/recommendations/api/recommendations
from 192.168.XXX.XXX by user at 2019-05-14T06:37:17+00:00


[remote] Error: Error: Call to a member function getCache() on null at <<closure>>

 0. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 382
    OCA\Files_Sharing\SharedStorage->getSourceRootInfo()
 1. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 393
    OCA\Files_Sharing\SharedStorage->getCache("", OCA\Files_Trashb ... l})
 2. /var/www/nextcloud/lib/private/Files/View.php line 1726
    OC\Files\Storage\Wrapper\Wrapper->getCache()
 3. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 128
    OC\Files\View->getPath(219317)
 4. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 477
    OCA\Files_Sharing\SharedStorage->init()
 5. <<closure>>
    OCA\Files_Sharing\SharedStorage->getSourceStorage()
 6. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 506
    undefinedundefinedcall_user_func_array([OCA\Files_Shari ... "], [])
 7. /var/www/nextcloud/apps/files_sharing/lib/Cache.php line 93
    OC\Files\Storage\Wrapper\Wrapper->__call("getSourceStorage", [])
 8. /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php line 321
    OCA\Files_Sharing\Cache->getCache()
 9. /var/www/nextcloud/lib/private/Files/View.php line 1727
    OC\Files\Cache\Wrapper\CacheJail->getPathById(198450)
10. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 128
    OC\Files\View->getPath(198450)
11. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 112
    OCA\Files_Sharing\SharedStorage->init()
12. /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php line 382
    OCA\Files_Sharing\SharedStorage->getSourceRootInfo()
13. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 393
    OCA\Files_Sharing\SharedStorage->getCache("", OCA\Files_Trashb ... l})
14. /var/www/nextcloud/lib/private/Files/View.php line 1470
    OC\Files\Storage\Wrapper\Wrapper->getCache("")
15. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 265
    OC\Files\View->getDirectoryContent("/")
16. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/TagsPlugin.php line 224
    OCA\DAV\Connector\Sabre\Directory->getChildren()
17. <<closure>>
    OCA\DAV\Connector\Sabre\TagsPlugin->handleGetProperties(Sabre\DAV\PropFind {}, OCA\DAV\Files\FilesHome {})
18. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([OCA\DAV\Connect ... "], [Sabre\DAV\PropF ... }])
19. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1059
    Sabre\Event\EventEmitter->emit("propFind", [Sabre\DAV\PropF ... }])
20. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 981
    Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\DAV\Files\FilesHome {})
21. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1666
    Sabre\DAV\Server->getPropertiesIteratorForPath("files/vaneenw", ["{DAV:}getlastm ... "], 1)
22. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 355
    Sabre\DAV\Server->generateMultiStatus(Generator {}, false)
23. <<closure>>
    Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
24. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPropFind"], [Sabre\HTTP\Requ ... }])
25. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PROPFIND", [Sabre\HTTP\Requ ... }])
26. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
27. /var/www/nextcloud/apps/dav/lib/Server.php line 316
    Sabre\DAV\Server->exec()
28. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
29. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

PROPFIND /remote.php/dav/files/user/
from 192.168.XXX.XXX by user at 2019-05-14T06:37:16+00:00

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

<?php
$CONFIG = array (
  'passwordsalt' => 'salt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => 'localhost',
   ),
  'datadirectory' => '/var/ncdata',
  'overwrite.cli.url' => 'https://cloud.company.com',
  'overwritehost' => 'cloud.company.com',
  'overwriteprotocol' => 'https',
  'dbtype' => 'mysql',
  'version' => '16.0.0.9',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_ncadmin',
  'dbpassword' => 'password',
  'installed' => true,
  'instanceid' => 'instanceid',
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'log_rotate_size' => '10485760',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 0,
    'password' => 'password',
  ),
  'htaccess.RewriteBase' => '/',
  'loglevel' => 2,
  'default_language' => 'nl',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'skeletondirectory' => '/var/ncdata/skeleton',
  'updater.release.channel' => 'production',
  'ldapUserCleanupInterval' => 51,
  'mail_sendmailmode' => 'smtp',
  'has_rebuilt_cache' => true,
);

How can this be solved please? My user may be reset as I have a backup of all the files.

kr

wouter

This problem was solved after I’ve upgraded to 16.0.3.

kr
wouter