Skip to content

[Bug]: No way to remove existing previews #56485

@invario

Description

@invario

⚠️ This issue respects the following points: ⚠️

Bug description

There doesn't appear to be a way to purge existing previews. Previously, removing all files from the data/appdata_***/preview folder followed by occ files:scan-app-data would update all necessary tables. I have also attempted occ preview:cleanup. As a result, an error is thrown.

I have performed a fresh reset of the server with only about 4 movie files uploaded for testing purposes. (This is my dev setup.)

Steps to reproduce

  1. Upload or have existing files that previews are generated for
  2. Attempt to delete the preview files either manually (delete preview directory followed with occ files:scan-app-data) or occ preview:cleanup
  3. Reload nextcloud site, see no previews, examine logs and see error thrown.

Expected behavior

Database should be properly updated.

Nextcloud Server version

master

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

MariaDB

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

Fresh Nextcloud Server install

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

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nextcloud3.*****.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "33.0.0.3",
        "overwrite.cli.url": "https:\/\/nextcloud3.*****.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "git",
        "installed": true,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "logfile": "\/mnt\/nextcloud_data\/nextcloud.log",
        "loglevel": 1,
        "enabledPreviewProviders": [
            "OC\\Preview\\HEIC",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI",
            "OC\\Preview\\Movie",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\PNG",
            "OC\\Preview\\Image",
            "OC\\Preview\\TIFF"
        ],
        "filelocking.enabled": true,
        "default_locale": "en_US",
        "default_phone_region": "US",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "cropimagepreviews": "0",
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "jpeg_quality": 60,
        "logtimezone": "America\/New_York",
        "overwritehost": "nextcloud3.*****.com",
        "overwriteprotocol": "https",
        "maintenance_window_start": 8,
        "trashbin_retention_obligation": "10, 2",
        "mail_smtpport": "465",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false
    }
}

List of activated Apps

Enabled:
  - admin_audit: 1.23.0
  - cloud_federation_api: 1.17.0
  - comments: 1.23.0
  - contactsinteraction: 1.14.1
  - dashboard: 7.13.0
  - dav: 1.35.0
  - federatedfilesharing: 1.23.0
  - federation: 1.23.0
  - files: 2.5.0
  - files_external: 1.25.1
  - files_reminders: 1.6.0
  - files_sharing: 1.25.1
  - files_trashbin: 1.23.0
  - files_versions: 1.26.0
  - logreader: 6.0.0-dev.0
  - lookup_server_connector: 1.21.0
  - notifications: 6.0.0-dev.0
  - oauth2: 1.21.0
  - profile: 1.2.0
  - provisioning_api: 1.23.0
  - settings: 1.16.0
  - sharebymail: 1.23.0
  - systemtags: 1.23.0
  - theming: 2.8.0
  - twofactor_backupcodes: 1.22.0
  - updatenotification: 1.23.0
  - user_status: 1.13.0
  - viewer: true
  - weather_status: 1.13.0
  - webhook_listeners: 1.4.1
  - workflowengine: 2.15.0
Disabled:
  - encryption: 2.21.0
  - testing: 1.23.0
  - user_ldap: 1.24.0

Nextcloud Signing status

Integrity checker has been disabled. Integrity cannot be verified.

Nextcloud Logs

{"reqId":"JwdynlaIQyPKnYaWg6KO","level":3,"time":"2025-11-15T20:41:19-05:00","remoteAddr":"***.***.***.***","user":"admin","app":"index","method":"GET","url":"/core/preview?fileId=48&x=128&y=128&mimeFallback=true&v=69191d&a=0","message":"Unable to open preview stream at /mnt/nextcloud_data/appdata_ocg576kyp814/preview/6/4/2/e/9/2/e/48/256-256-crop.jpg","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","version":"33.0.0.3","exception":{"Exception":"OCP\\Files\\NotFoundException","Message":"Unable to open preview stream at /mnt/nextcloud_data/appdata_ocg576kyp814/preview/6/4/2/e/9/2/e/48/256-256-crop.jpg","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Preview/Storage/StorageFactory.php","line":34,"function":"readPreview","class":"OC\\Preview\\Storage\\LocalPreviewStorage","type":"->","args":[{"__class__":"OC\\Preview\\Db\\Preview","id":"17094786773901313"}]},{"file":"/var/www/html/lib/private/Preview/Storage/PreviewFile.php","line":48,"function":"readPreview","class":"OC\\Preview\\Storage\\StorageFactory","type":"->","args":[{"__class__":"OC\\Preview\\Db\\Preview","id":"17094786773901313"}]},{"file":"/var/www/html/lib/public/AppFramework/Http/FileDisplayResponse.php","line":52,"function":"getContent","class":"OC\\Preview\\Storage\\PreviewFile","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":210,"function":"callback","class":"OCP\\AppFramework\\Http\\FileDisplayResponse","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Output"}]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\PreviewController","getPreviewByFileId",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.preview.getpreviewbyfileid"}]},{"file":"/var/www/html/lib/base.php","line":1096,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Preview/Storage/LocalPreviewStorage.php","Line":60,"message":"Unable to open preview stream at /mnt/nextcloud_data/appdata_ocg576kyp814/preview/6/4/2/e/9/2/e/48/256-256-crop.jpg","exception":{},"CustomMessage":"Unable to open preview stream at /mnt/nextcloud_data/appdata_ocg576kyp814/preview/6/4/2/e/9/2/e/48/256-256-crop.jpg"}}

Additional info

The entries in the database table oc_previews remain even though the appdata_***/preview directory has been removed. Neither occ files:scan-app-data nor occ preview:cleanup work to remove the entries. However, executing delete from oc_previews; directly in MariaDB works.

Any relation to #55709 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap33-feedbackbug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions