⚠️ This issue respects the following points: ⚠️
Bug description
Preview generation completely fails for any file located in external storage mounts (files_external app), affecting both images and videos.
The occ preview:generate <fileId> command incorrectly reports "preview generated" but no preview file is actually written to disk. The same behavior affects occ preview:generate-all --path=..., which scans folders but generates nothing.
Impact:
- ~46,000 image and video files in external storage have no preview thumbnails in the Files app
- The Viewer app cannot open these files properly (clicking on an image without a preview causes the viewer to navigate back one folder level instead of displaying the file correctly)
preview:pre-generate running via cron does NOT cover these files
preview:generate-all reports "Scanning folder" but produces zero generated previews
Diagnostic data from my instance:
- Total files with image/video mimetypes in
oc_filecache: ~74,200
- Files with generated previews on disk: 27,978 (~37%)
- The ~46,000 missing previews are all on external storage mounts
- Files uploaded to the user's home directory (not external storage) have previews generated correctly
Configurations already tested without success:
- Changed
previewgenerator app config types from filesystem to filesystem external
- Verified
previews: "1" is set on external storage mounts
- Verified filesystem permissions (
www-data:www-data) on appdata preview folder
- Verified mimetype detection (
image/jpeg correctly identified as ID 14)
- Ran
occ db:add-missing-indices
- Cron runs as
www-data (both container cron and host crontab as redundancy)
Note: Upgrade from 33.0.2 to 33.0.3 did NOT fix this issue. This appears related to #56510 (reported on 32.0.1, still unresolved), suggesting the bug spans multiple releases.
Steps to reproduce
- Configure an external storage mount using the Local backend (e.g., a filesystem bind-mount pointing to a path outside the Nextcloud data directory)
- Upload images or videos to that external storage, OR have existing files in the mounted path
- Run as the web user inside the container:
sudo docker exec -u www-data nextcloud php occ preview:generate <fileId>
- Observe the output:
preview generated
- Check on disk if the preview was actually created:
sudo find /path/to/data/appdata_<instanceid>/preview/ -type d -name "<fileId>"
- Result: nothing is found — the preview folder for that fileId was never created
Equivalent attempts that also fail silently (return success, but write nothing to disk):
occ preview:generate <full/path/to/file> (also returns "preview generated")
occ preview:generate-all <user> (no per-file output for external storage files)
occ preview:generate-all <user> --path="/<user>/files/<external_mount_name>/..." (only outputs "Scanning folder", never generates)
- Opening the file via the web Viewer (Viewer redirects to parent folder instead of displaying the file)
- HTTP request to
/index.php/core/preview?fileId=<id> with valid app password authentication returns empty array []
Important: the exact same operations work correctly for files stored in the user's regular home directory (not external storage). Only files in external storage mounts exhibit this silent failure.
Expected behavior
The preview should be generated and stored in the appdata preview folder, exactly as happens for files in the user's home directory (non-external storage).
If preview generation fails for any reason (permission, codec, file access, etc.), the command should:
- Return a non-zero exit code
- Print a clear error message describing what went wrong
- Log the failure at default loglevel
The current silent failure (returning success message + zero exit code + no preview file on disk + no error in logs) makes the issue impossible to diagnose without deep inspection of the database and filesystem.
Nextcloud Server version
33
Operating system
Other
PHP engine version
PHP 8.4
Web server
Apache (supported)
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 32.0.1 to 32.0.2)
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"password": "***REMOVED SENSITIVE VALUE***",
"port": 6379
},
"overwriteprotocol": "https",
"upgrade.disable-web": true,
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"192.168.x.x",
"cloud.example.com"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "pgsql",
"version": "33.0.3.2",
"overwrite.cli.url": "https:\/\/cloud.example.com",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"maintenance": false,
"filesystem_check_changes": 1,
"unicode.normalization.form": "NFC",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"forwarded_for_headers": [
"HTTP_X_FORWARDED_FOR"
],
"overwritehost": "cloud.example.com",
"enabledPreviewProviders": [
"OC\\Preview\\PNG",
"OC\\Preview\\JPEG",
"OC\\Preview\\GIF",
"OC\\Preview\\BMP",
"OC\\Preview\\XBitmap",
"OC\\Preview\\Movie",
"OC\\Preview\\MP4"
],
"max_chunk_size": 104857600,
"preview_max_x": "2048",
"preview_max_y": "2048",
"jpeg_quality": "80",
"excluded_directories": [
"private-folder"
],
"loglevel": 2
}
}
List of activated Apps
Enabled:
- activity: 6.0.0
- admincockpit: 1.3.0
- app_api: 33.0.0
- bruteforcesettings: 6.0.0
- circles: 33.0.0
- cloud_federation_api: 1.17.0
- comments: 1.23.0
- contactsinteraction: 1.14.1
- dashboard: 7.13.0
- dav: 1.36.0
- external: 8.0.1
- federatedfilesharing: 1.23.0
- federation: 1.23.0
- files: 2.5.0
- files_downloadlimit: 5.1.0
- files_external: 1.25.1
- files_pdfviewer: 6.0.0
- files_reminders: 1.6.0
- files_sharing: 1.25.2
- files_trashbin: 1.23.0
- files_versions: 1.26.0
- firstrunwizard: 6.0.0
- logreader: 6.0.0
- lookup_server_connector: 1.21.0
- nextcloud_announcements: 5.0.0
- notifications: 6.0.0
- oauth2: 1.21.0
- password_policy: 5.0.0
- photos: 6.0.0
- previewgenerator: 5.13.0
- privacy: 5.0.0
- profile: 1.2.0
- provisioning_api: 1.23.0
- recommendations: 6.0.0
- related_resources: 4.0.0
- richdocuments: 10.1.3
- richdocumentscode: 25.4.904
- serverinfo: 5.0.0
- settings: 1.16.0
- sharebymail: 1.23.0
- support: 5.0.0
- survey_client: 5.0.0
- systemtags: 1.23.0
- text: 7.0.1
- theming: 2.8.0
- twofactor_backupcodes: 1.22.0
- twofactor_totp: 15.0.0
- updatenotification: 1.23.0
- user_status: 1.13.0
- viewer: 6.0.0
- weather_status: 1.13.0
- webhook_listeners: 1.5.0
- workflowengine: 2.15.0
Disabled:
- admin_audit: 1.23.0
- encryption: 2.21.0
- suspicious_login: 11.0.0
- testing: 1.23.0
- twofactor_nextcloud_notification: 7.0.0
- user_ldap: 1.24.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
The following exception is logged when accessing a file in external storage that should have a preview (preview entry exists in database but the actual preview file was never created on disk):
{"level":3,"time":"2026-05-29T18:51:24+00:00","user":"casaos","app":"index","method":"GET","url":"/core/preview?fileId=24713&x=128&y=128&mimeFallback=true&v=da7a04&a=0","message":"Unable to open preview stream at /var/www/html/data/appdata_INSTANCEID/preview/8/a/3/e/0/4/0/24713/256-256-crop.jpg","version":"33.0.3.2","exception":{"Exception":"OCP\\Files\\NotFoundException","Message":"Unable to open preview stream at /var/www/html/data/appdata_INSTANCEID/preview/8/a/3/e/0/4/0/24713/256-256-crop.jpg","File":"/var/www/html/lib/private/Preview/Storage/LocalPreviewStorage.php","Line":60}}
KEY FINDING: The preview entry was registered in the database (OC\Preview\Db\Preview object exists with an ID), but the actual preview file was never created in the appdata directory. The Nextcloud upgrade from 33.0.2 to 33.0.3 added a new repair step "Queue a job to move the preview" — this suggests previews were moved to a new location, but for files in external storage, the source files never existed in the first place.
When running `occ preview:generate <fileId>` for any file in external storage:
- Command returns "preview generated"
- A new preview entry is created in the database
- BUT no file is created in /var/www/html/data/appdata_INSTANCEID/preview/<hash>/<fileId>/
- Subsequent requests for that preview fail with NotFoundException at LocalPreviewStorage.php:60
For files in the user's home directory (non-external storage), the same command works correctly and the preview file is properly written to disk.
Additional info
Container details
- Container image: bigbeartechworld/big-bear-nextcloud-with-smbclient:33.0.3 (digest sha256:f597ae02ebf0fc7640440273b273050f16b8437f566609dbf15230edbb20d9cf)
- This image is built on top of the official Nextcloud Apache image with smbclient added to support SMB-based external storage
- Upgraded from 33.0.2 to 33.0.3 specifically to test if this bug was fixed — it was not
External storage configuration
Two external storage mounts configured, both using the "Local" backend with bind-mounted volumes from the host (mount points anonymized):
| Mount ID |
Mount Point |
Storage |
Auth |
Configuration |
| 1 |
/MountA |
Local |
None |
datadir: "/mnt/MountA" |
| 2 |
/MountB |
Local |
None |
datadir: "/mnt/MountB" |
Both mounts have previews: "1" and filesystem_check_changes: "1" enabled, applicable to two regular users.
Database evidence
The preview registration entries DO exist in the database for affected files. Example query result for a specific fileId shows the file is properly indexed in oc_filecache with storage ID 3 (external storage):
fileid: 24713
storage: 3
path: .jpg
But there is no corresponding folder in /var/www/html/data/appdata_INSTANCEID/preview/ for this fileId.
Statistics from my instance
- Total files in oc_filecache with image/video mimetypes: 74,200
- Total preview folders on disk: 27,978 fileIds (~37% coverage)
- Smallest fileId with preview: 11,494
- Largest fileId with preview: 3,177,680
- Gap distribution: random — preview folders exist for some fileIds in any range, but the majority of older fileIds (lower numbers) are missing previews. This suggests preview:generate-all was attempted in the past, processed some files, but silently failed on most.
Reproducibility
100% reproducible on my instance. Every attempt to generate a preview for a file in external storage results in:
- occ preview:generate returns success
- No preview file is written to disk
- Subsequent attempts to access that preview return NotFoundException from LocalPreviewStorage.php:60
Workarounds attempted (all failed)
- Setting previewgenerator app types to "filesystem external" (default is just "filesystem")
- Running occ files:scan --path="<external_storage_path>" followed by preview:generate
- Running occ preview:generate-all (only outputs "Scanning folder" for external storage paths, never generates)
- Running as www-data user inside container with docker exec -u www-data
- HTTP request to /index.php/core/preview with valid app password authentication
Related issues
Browser
This affects all clients/browsers (Chrome 148, Safari, Firefox, Nextcloud desktop sync client 33.0.5, Nextcloud iOS app). It is server-side, not client-side.
Bug description
Preview generation completely fails for any file located in external storage mounts (files_external app), affecting both images and videos.
The
occ preview:generate <fileId>command incorrectly reports "preview generated" but no preview file is actually written to disk. The same behavior affectsocc preview:generate-all --path=..., which scans folders but generates nothing.Impact:
preview:pre-generaterunning via cron does NOT cover these filespreview:generate-allreports "Scanning folder" but produces zero generated previewsDiagnostic data from my instance:
oc_filecache: ~74,200Configurations already tested without success:
previewgeneratorapp configtypesfromfilesystemtofilesystem externalpreviews: "1"is set on external storage mountswww-data:www-data) on appdata preview folderimage/jpegcorrectly identified as ID 14)occ db:add-missing-indiceswww-data(both container cron and host crontab as redundancy)Note: Upgrade from 33.0.2 to 33.0.3 did NOT fix this issue. This appears related to #56510 (reported on 32.0.1, still unresolved), suggesting the bug spans multiple releases.
Steps to reproduce
sudo docker exec -u www-data nextcloud php occ preview:generate <fileId>preview generatedsudo find /path/to/data/appdata_<instanceid>/preview/ -type d -name "<fileId>"Equivalent attempts that also fail silently (return success, but write nothing to disk):
occ preview:generate <full/path/to/file>(also returns "preview generated")occ preview:generate-all <user>(no per-file output for external storage files)occ preview:generate-all <user> --path="/<user>/files/<external_mount_name>/..."(only outputs "Scanning folder", never generates)/index.php/core/preview?fileId=<id>with valid app password authentication returns empty array[]Important: the exact same operations work correctly for files stored in the user's regular home directory (not external storage). Only files in external storage mounts exhibit this silent failure.
Expected behavior
The preview should be generated and stored in the appdata preview folder, exactly as happens for files in the user's home directory (non-external storage).
If preview generation fails for any reason (permission, codec, file access, etc.), the command should:
The current silent failure (returning success message + zero exit code + no preview file on disk + no error in logs) makes the issue impossible to diagnose without deep inspection of the database and filesystem.
Nextcloud Server version
33
Operating system
Other
PHP engine version
PHP 8.4
Web server
Apache (supported)
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 32.0.1 to 32.0.2)
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
{ "system": { "htaccess.RewriteBase": "\/", "memcache.local": "\\OC\\Memcache\\APCu", "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "password": "***REMOVED SENSITIVE VALUE***", "port": 6379 }, "overwriteprotocol": "https", "upgrade.disable-web": true, "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "192.168.x.x", "cloud.example.com" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "pgsql", "version": "33.0.3.2", "overwrite.cli.url": "https:\/\/cloud.example.com", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "instanceid": "***REMOVED SENSITIVE VALUE***", "installed": true, "maintenance": false, "filesystem_check_changes": 1, "unicode.normalization.form": "NFC", "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "forwarded_for_headers": [ "HTTP_X_FORWARDED_FOR" ], "overwritehost": "cloud.example.com", "enabledPreviewProviders": [ "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\BMP", "OC\\Preview\\XBitmap", "OC\\Preview\\Movie", "OC\\Preview\\MP4" ], "max_chunk_size": 104857600, "preview_max_x": "2048", "preview_max_y": "2048", "jpeg_quality": "80", "excluded_directories": [ "private-folder" ], "loglevel": 2 } }List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
Container details
External storage configuration
Two external storage mounts configured, both using the "Local" backend with bind-mounted volumes from the host (mount points anonymized):
Both mounts have previews: "1" and filesystem_check_changes: "1" enabled, applicable to two regular users.
Database evidence
The preview registration entries DO exist in the database for affected files. Example query result for a specific fileId shows the file is properly indexed in oc_filecache with storage ID 3 (external storage):
fileid: 24713
storage: 3
path: .jpg
But there is no corresponding folder in /var/www/html/data/appdata_INSTANCEID/preview/ for this fileId.
Statistics from my instance
Reproducibility
100% reproducible on my instance. Every attempt to generate a preview for a file in external storage results in:
Workarounds attempted (all failed)
Related issues
Browser
This affects all clients/browsers (Chrome 148, Safari, Firefox, Nextcloud desktop sync client 33.0.5, Nextcloud iOS app). It is server-side, not client-side.