Undefined index issue

Lately (I belive since update to nextcloud 13.0.2) I keep seeing lots of undefined index error messages in my logs such as:

"Undefined index: encrypted at \/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Cache.php#171"
"Undefined index: storage at \/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Cache.php#173"
"Undefined index: mimetype at \/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Cache.php#175"
"Undefined index: permissions at \/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Cache.php#180"

I was wondering if anyone here has similar issues. Also wanted to perhaps establish whether its only my instance related issue before I make a bug report on github.

Any ideas on what could be causing this error is greatly appreciated.

The issue is still there.
I’ve run file:scan on all files, and I flushed redis db just to be sure.

| oc_filecache |          0 | PRIMARY              |            1 | fileid      |
| oc_filecache |          0 | fs_storage_path_hash |            1 | storage     |
| oc_filecache |          0 | fs_storage_path_hash |            2 | path_hash   |
| oc_filecache |          1 | fs_parent_name_hash  |            1 | parent      |
| oc_filecache |          1 | fs_parent_name_hash  |            2 | name        |
| oc_filecache |          1 | fs_storage_mimetype  |            1 | storage     |
| oc_filecache |          1 | fs_storage_mimetype  |            2 | mimetype    |
| oc_filecache |          1 | fs_storage_mimepart  |            1 | storage     |
| oc_filecache |          1 | fs_storage_mimepart  |            2 | mimepart    |
| oc_filecache |          1 | fs_storage_size      |            1 | storage     |
| oc_filecache |          1 | fs_storage_size      |            2 | size        |
| oc_filecache |          1 | fs_storage_size      |            3 | fileid      |

So indeed no storage, mimetype, permissions etc. Unless I’m looking at the wrong place in the database. I compared it with another instance and the table is identical but I dont get the error message.

Any idea on what might be going on here?


This is actually not related to DB tables. The error message you receive mention a problem with the Nextcloud code in file /var/www/nextcloud/lib/private/Files/Cache/Cache.php

The error message refers to the following function:

    public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) {
            //fix types
            $data['fileid'] = (int)$data['fileid'];
            $data['parent'] = (int)$data['parent'];
            $data['size'] = 0 + $data['size'];
            $data['mtime'] = (int)$data['mtime'];
            $data['storage_mtime'] = (int)$data['storage_mtime'];
            $data['encryptedVersion'] = (int)$data['encrypted'];
            $data['encrypted'] = (bool)$data['encrypted'];
            $data['storage_id'] = $data['storage'];
            $data['storage'] = (int)$data['storage'];
            $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']);
            $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']);

What you see here are arrays with an index (the string in the brackets). One specific example:

$data['encryptedVersion'] = (int)$data['encrypted'];

Here it is tried to extract the value for the index ‘encrypted’ from the array ‘data’. And that index is undefined/ doesn’t exist - as the error message describes.

I don’t know the root cause though. Maybe you have an encryption app enabled or use encryption and there is something wrong. Is this a debug, info, warning or critical message?

@Schmu thanks for looking into my issue.

Its warning.

I do have encryption on, but I was getting the message on pretty much all indexes (including storage, mimetype etc upon upload for example). About two hours ago I decided to switch off redis and seems like the message in logs is gone and my cpu load dropped significantly (more then half).

Looks like I was too quick with my assumptions. The message is back :frowning:

I can reproduce it on mobile (seems like its mostly associated with mobile user agents) by just browsing files, and opening documents. for each file i get missing index for: parent, size, mtime, storage_mtime, encrypted, mimetype, mimepart, permissions

Seems like the issue is triggered by end-to-end encryption app. The moment it is enabled I get the message in the log on all file operations, even if no encrypted folder present on user account.

I guess this is not expected behaviour or is it?
(both end-to-end encryption app and nextcloud are running latest stable version).

The end-to-end encryption app was still beta as far as I know.
Nonetheless, it looks like something the developers might want to look into.

I suggest opening an issue on GitHub.

Im all for this bug its extremely spammy not to mention annoying thing.
BTW 8 months and no working solution for this? hey seriously??

The original posting has been opened for Nextcloud 13, which is not supported anymore. It might be possible that this problem has already been fixed in a newer release. Are you still using NC 13 or are you using a different version and can still reproduce the problem?