previewgenerator icon indicating copy to clipboard operation
previewgenerator copied to clipboard

Undefined array key "previews" at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php#160

Open srijansaxena11 opened this issue 1 year ago • 9 comments

I am getting the above error message in my Nextcloud logs every 10 minutes.

[PHP] Error: Undefined array key "previews" at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php#160

The error is pointing to this line: image

srijansaxena11 avatar Apr 21 '24 19:04 srijansaxena11

Which version of Nextcloud are you running?

st3iny avatar Apr 22 '24 06:04 st3iny

Which version of Nextcloud are you running?

It's latest stable 28.0.4. I am happy to provide any other details if required and/or try anything to see if that resolves the issue.

srijansaxena11 avatar Apr 22 '24 15:04 srijansaxena11

Which version of Nextcloud are you running?

What other details can I provide to debug/resolve it?

srijansaxena11 avatar Apr 25 '24 15:04 srijansaxena11

It's related to your External Storage configuration. It seems like one of your mounts is lacking the preview field in its config (which is a little weird).

Please send the output of occ files_external:list --output=json_pretty.

joshtrichards avatar May 01 '24 17:05 joshtrichards

It's related to your External Storage configuration. It seems like one of your mounts is lacking the preview field in its config (which is a little weird).

Please send the output of occ files_external:list --output=json_pretty.

Hi. Please find it below:

[
    {
        "mount_id": 4,
        "mount_point": "\/var\/lib\/media",
        "storage": "\\OC\\Files\\Storage\\Local",
        "authentication_type": "null::null",
        "configuration": {
            "datadir": "\/var\/lib\/media"
        },
        "options": {
            "enable_sharing": false
        },
        "applicable_users": [],
        "applicable_groups": []
    },
    {
        "mount_id": 5,
        "mount_point": "\/External_Storage",
        "storage": "\\OC\\Files\\Storage\\Local",
        "authentication_type": "null::null",
        "configuration": {
            "datadir": "\/var\/lib\/media"
        },
        "options": {
            "enable_sharing": false
        },
        "applicable_users": [],
        "applicable_groups": []
    }
]

srijansaxena11 avatar May 10 '24 16:05 srijansaxena11

What can I do to fix it?

srijansaxena11 avatar Jun 26 '24 17:06 srijansaxena11

Hello?

srijansaxena11 avatar Jul 16 '24 08:07 srijansaxena11

This isn't an issue in the previewgenerator.

Somehow nearly all your options are missing from your mount. The config would normally look more like this:

    {
        "mount_id": 5,
        "mount_point": "\/extLocalTmp",
        "storage": "\\OC\\Files\\Storage\\Local",
        "authentication_type": "null::null",
        "configuration": {
            "datadir": "\/tmp"
        },
        "options": {
            "encrypt": true,
            "previews": true,
            "enable_sharing": false,
            "filesystem_check_changes": 1,
            "encoding_compatibility": false,
            "readonly": false
        },
        "applicable_users": [],
        "applicable_groups": []
    }
]

How did you originally setup/add your External Storage in your Nextcloud Server? And what's the history of this installation? (i.e. has it been around awhile?)

If there is a bug, it's in server/files_external, since that configuration isn't valid per se. Assuming you're using those mounts, you can probably workaround it by:

  • exporting the config manually
  • editing your options sections to mirror my example above
  • importing the fixed configuration

See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#files-external-label for the occ files_external:export & files_external:import commands.

P.S. You have two entries for the same local storage folder (/var/lib/media). If I was to guess, mount 4 isn't actually being used.

joshtrichards avatar Jul 16 '24 12:07 joshtrichards

[
    {
        "mount_id": 7,
        "mount_point": "\/External_Storage",
        "storage": "\\OC\\Files\\Storage\\Local",
        "authentication_type": "null::null",
        "configuration": {
            "datadir": "\/var\/lib\/media"
        },
        "options": {
            "enable_sharing": false,
            "previews": false
        },
        "applicable_users": [],
        "applicable_groups": []
    }
]

Is this okay now? I am still getting the same error with this configuration too. Do I need to restart something?

srijansaxena11 avatar Aug 10 '24 16:08 srijansaxena11