Error with previews while browsing music files

My nextcloud log is flooded with error messages while browsing my music folder:

Error	PHP	imagecreatefromstring(): Empty string or invalid image at /var/www/owncloud/lib/private/legacy/image.php#597	2016-12-17T17:57:59+0100
Error	PHP	fclose() expects parameter 1 to be resource, boolean given at /var/www/owncloud/lib/private/Files/Storage/Local.php#218	2016-12-17T17:57:59+0100
Error	PHP	fread() expects parameter 1 to be resource, boolean given at /var/www/owncloud/lib/private/Files/Storage/Local.php#217	2016-12-17T17:57:59+0100
Error	PHP	fopen(/mnt/sda/ncdata/Micha/files/var/www/owncloud/core/img/filetypes/audio.svg): failed to open stream: No such file or directory at /var/www/owncloud/lib/private/Files/Storage/Local.php#216	2016-12-17T17:57:59+0100
Error	PHP	filesize(): stat failed for /mnt/sda/ncdata/Micha/files/var/www/owncloud/core/img/filetypes/audio.svg at /var/www/owncloud/lib/private/Files/Storage/Local.php#211

This seems to appear for every single file. The dev tools of my browser show the following error for every file:

GET https://<my nextcloud url>/core/preview.png?file=%2FMusik%2F01-Come+Talk+To+Me.mp3&c=62ca273559a808791f3036458627e454&x=32&y=32&forceIcon=0 404 ()

Some software added previews to my mp3 files that are also shown as previews in nextcloud. The error appears for every file that does not have an internal preview. It also reappears every time again for the same files.

I just installed the preview generator app, but the error appeared already before that and I already ran preview:delete_old to remove the old previews.

A lot of people having this issue including me for this NC11 :frowning:

This was already with nc 10 as I remember. I guess it’s something that nc tries to generate some preview for the mp3 files, but not every mp3 file contains a cover image and therefore nc does not find any content to create a preview of?

The admin manual gives hints for a workaround:
https://docs.nextcloud.com/server/11/admin_manual/configuration_server/config_sample_php_parameters.html#previews

mp3 files are enabled for previews by default. By giving the array without mp3 files to the config.php, the errors should not appear anymore, but on the other hand previews for mp3 files WITH cover image inside will also not be shown anymore. For me this is no problem, as I anyway don’t know which software added this covers automatically without asking me about it ;).

'enabledPreviewProviders' => array(
        'OC\Preview\PNG',
        'OC\Preview\JPEG',
        'OC\Preview\GIF',
        'OC\Preview\BMP',
        'OC\Preview\XBitmap',
        'OC\Preview\MP3', //remove this line!
        'OC\Preview\TXT',
        'OC\Preview\MarkDown'
),

Is there some solution about this on the way? Hmpf I guess I have to make a github account to open the issue there.

Ah it is actually already there: https://github.com/nextcloud/server/issues/2739 Thanks @Rello for opening it. It is actually not just for shared folders, as my music folder is not a shared one. But as I can see the ideas on github issue it is also for me related to svg preview files, see my log on top.

Yes, core has some issues hoe it handles the audio.svg file.
Lets see what the masters will come up with.

But for the moment everything is functional - as long as you dont view the logs :wink:

Hmm with nc 11.0.2 RC2 the error persists, even that the changelog sais “Make sure invalid images don't flood the log file (server/3440)”:

Error	PHP	imagecreatefromstring(): Empty string or invalid image at /var/www/owncloud/lib/private/legacy/image.php#597	2017-02-27T16:00:08+0100
Error	PHP	fclose() expects parameter 1 to be resource, boolean given at /var/www/owncloud/lib/private/Files/Storage/Local.php#218	2017-02-27T16:00:08+0100
Error	PHP	fread() expects parameter 1 to be resource, boolean given at /var/www/owncloud/lib/private/Files/Storage/Local.php#217	2017-02-27T16:00:08+0100
Error	PHP	fopen(/path/to/ncdata/<user>/files/var/www/owncloud/core/img/filetypes/audio.svg): failed to open stream: No such file or directory at /var/www/owncloud/lib/private/Files/Storage/Local.php#216	2017-02-27T16:00:08+0100
Error	PHP	filesize(): stat failed for /path/to/ncdata/<user>/files/var/www/owncloud/core/img/filetypes/audio.svg at /var/www/owncloud/lib/private/Files/Storage/Local.php#211	2017-02-27T16:00:08+0100

Resolved in between. No error messages anymore and all previews show up, that I can also see i.e. windows explorer.