nextcloud / nextcloud/server

[Bug]: Call to a member function instanceOfStorage() on null

Open
#55,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 30-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Last month in logs I have started to observe erorrs and warning:
``
[index] Error: Call to a member function instanceOfStorage() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Cache.php' line 70
GET /index.php/apps/files/files/***?dir=/Shared/myfolder
from **** user username on 13 Sep 2025 at 00:00:00

[no app in context] Warning: Possible share setup recursion detected
GET /index.php/apps/files/files/***?dir=/Shared/myfolder
from **** user username on 13 Sep 2025 at 00:00:00

``

Steps to reproduce
  1. Use file sharing
  2. Share a some folder
  3. Observe above mentioned errors
Expected behavior

No errors to be observed

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3-fpm

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

{"reqId":"*****","level":3,"time":"2025-09-13T16:34:41+03:00","remoteAddr":"*****","user":"username","app":"index","method":"GET","url":"/index.php/apps/files/files/***?dir=/Shared/myfolder","message":"Call to a member function instanceOfStorage() on null in file '/www/html/nextcloud/apps/files_sharing/lib/Cache.php' line 70","userAgent":"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","version":"30.0.15.1","exception":{"Exception":"Exception","Message":"Call to a member function instanceOfStorage() on null in file '/www/html/nextcloud/apps/files_sharing/lib/Cache.php' line 70","Code":0,"Trace":[{"file":"/www/html/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/www/html/nextcloud/lib/private/Route/Router.php","line":303,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/www/html/nextcloud/lib/base.php","line":1032,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/www/html/nextcloud/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"Error","Message":"Call to a member function instanceOfStorage() on null","Code":0,"Trace":[{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php","line":63,"function":"getRoot","class":"OCA\\Files_Sharing\\Cache","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php","line":141,"function":"getSourcePath","class":"OC\\Files\\Cache\\Wrapper\\CacheJail","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php","line":149,"function":"getId","class":"OC\\Files\\Cache\\Wrapper\\CacheJail","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Check/FileSystemTags.php","line":155,"function":"getId","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Check/FileSystemTags.php","line":106,"function":"getFileIds","class":"OCA\\WorkflowEngine\\Check\\FileSystemTags","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Check/FileSystemTags.php","line":66,"function":"getSystemTags","class":"OCA\\WorkflowEngine\\Check\\FileSystemTags","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Service/RuleMatcher.php","line":224,"function":"executeCheck","class":"OCA\\WorkflowEngine\\Check\\FileSystemTags","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Service/RuleMatcher.php","line":159,"function":"check","class":"OCA\\WorkflowEngine\\Service\\RuleMatcher","type":"->"},{"file":"/www/html/nextcloud/apps/workflowengine/lib/Service/RuleMatcher.php","line":107,"function":"getMatchingOperations","class":"OCA\\WorkflowEngine\\Service\\RuleMatcher","type":"->"},{"file":"/www/html/nextcloud/apps/files_accesscontrol/lib/Operation.php","line":71,"function":"getFlows","class":"OCA\\WorkflowEngine\\Service\\RuleMatcher","type":"->"},{"file":"/www/html/nextcloud/apps/files_accesscontrol/lib/CacheWrapper.php","line":36,"function":"checkFileAccess","class":"OCA\\FilesAccessControl\\Operation","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php","line":72,"function":"formatCacheEntry","class":"OCA\\FilesAccessControl\\CacheWrapper","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Node/Root.php","line":474,"function":"get","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->"},{"function":"OC\\Files\\Node\\{closure}","class":"OC\\Files\\Node\\Root","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/www/html/nextcloud/lib/private/Files/Node/Root.php","line":472,"function":"array_map"},{"file":"/www/html/nextcloud/lib/private/Files/Node/LazyFolder.php","line":475,"function":"getByIdInPath","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/www/html/nextcloud/apps/files_sharing/lib/SharedStorage.php","line":150,"function":"getById","class":"OC\\Files\\Node\\LazyFolder","type":"->"},{"file":"/www/html/nextcloud/apps/files_sharing/lib/SharedStorage.php","line":554,"function":"init","class":"OCA\\Files_Sharing\\SharedStorage","type":"->"},{"function":"getSourceStorage","class":"OCA\\Files_Sharing\\SharedStorage","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":509,"function":"call_user_func_array"},{"function":"__call","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":509,"function":"call_user_func_array"},{"file":"/www/html/nextcloud/apps/files_sharing/lib/Cache.php","line":85,"function":"__call","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php","line":70,"function":"getCache","class":"OCA\\Files_Sharing\\Cache","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php","line":108,"function":"get","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->"},{"file":"/www/html/nextcloud/apps/files_sharing/lib/Cache.php","line":108,"function":"get","class":"OC\\Files\\Cache\\Wrapper\\CacheJail","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php","line":70,"function":"get","class":"OCA\\Files_Sharing\\Cache","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Node/Root.php","line":474,"function":"get","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->"},{"function":"OC\\Files\\Node\\{closure}","class":"OC\\Files\\Node\\Root","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/www/html/nextcloud/lib/private/Files/Node/Root.php","line":472,"function":"array_map"},{"file":"/www/html/nextcloud/lib/private/Files/Node/Root.php","line":406,"function":"getByIdInPath","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/www/html/nextcloud/lib/private/Files/Node/LazyFolder.php","line":479,"function":"getFirstNodeByIdInPath","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/www/html/nextcloud/apps/files/lib/Controller/ViewController.php","line":221,"function":"getFirstNodeById","class":"OC\\Files\\Node\\LazyFolder","type":"->"},{"file":"/www/html/nextcloud/apps/files/lib/Controller/ViewController.php","line":135,"function":"redirectToFileIfInTrashbin","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/www/html/nextcloud/apps/files/lib/Controller/ViewController.php","line":121,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"indexViewFileid","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/www/html/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/www/html/nextcloud/lib/private/Route/Router.php","line":303,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/www/html/nextcloud/lib/base.php","line":1032,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/www/html/nextcloud/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/www/html/nextcloud/apps/files_sharing/lib/Cache.php","Line":70},"message":"Call to a member function instanceOfStorage() on null in file '/www/html/nextcloud/apps/files_sharing/lib/Cache.php' line 70","exception":[],"CustomMessage":"Call to a member function instanceOfStorage() on null in file '/www/html/nextcloud/apps/files_sharing/lib/Cache.php' line 70"},"id":"68c5bdccd5570"}

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/files_sharing/lib/Cache.php line 70 and trace the reported call through the files_sharing, workflowengine, files_accesscontrol, and files entry points shown in the stack trace. Reproduce the error by opening a shared folder, then determine why the storage object is null. Done means shared-folder access no longer logs the error or recursion warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.