nextcloud / nextcloud/server

[Bug]: GenericFileException when uploading files to a shared folder

Open
#49,970 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 29-feedback bug feature: previews and thumbnails feature: sharing
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

When uploading a bunch of pictures to a shared folder, there were a lot of "An unknown error has occurred" errors. In the logs, I see GenericFileExceptions (from App "Index") and corresponding PHP errors ("Failed to open stream: No such file or directory", see below).

Steps to reproduce
  1. Create folder, share it
  2. Upload files
  3. "An unknown error has occurred"
Expected behavior

no error should occur

Nextcloud Server version

29

Operating system

Other

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

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

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
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
            }
        ],
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "akki",
            "akki.fin.earth",
            "192.168.200.9",
            "creideiki.homelinux.net",
            "cloud.helmut-bender.de"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "29.0.10.1",
        "overwrite.cli.url": "https:\/\/cloud.helmut-bender.de",
        "overwritehost": "cloud.helmut-bender.de",
        "overwritewebroot": "\/",
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "PLAIN",
        "loglevel": 0,
        "mail_smtpsecure": "tls",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "theme": "",
        "app_install_overwrite": [
            "maps"
        ],
        "maintenance_window_start": 23,
        "upgrade.disable-web": true
    }
}
List of activated Apps
Enabled:
  - activity: 2.21.1
  - bruteforcesettings: 2.9.0
  - calendar: 4.7.16
  - circles: 29.0.0-dev
  - cloud_federation_api: 1.12.0
  - comments: 1.19.0
  - contacts: 6.0.1
  - contactsinteraction: 1.10.0
  - dashboard: 7.9.0
  - dav: 1.30.1
  - deck: 1.13.3
  - epubviewer: 1.6.7
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.1
  - files_downloadlimit: 2.0.0
  - files_external: 1.21.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - firstrunwizard: 2.18.0
  - forms: 4.3.4
  - groupfolders: 17.0.8
  - integration_openstreetmap: 1.0.12
  - logreader: 2.14.0
  - lookup_server_connector: 1.17.0
  - maps: 1.4.0
  - metadata: 0.21.0
  - nextcloud_announcements: 1.18.0
  - notes: 4.11.0
  - notifications: 2.17.0
  - oauth2: 1.17.1
  - password_policy: 1.19.0
  - photos: 2.5.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - serverinfo: 1.19.0
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - support: 1.12.0
  - survey_client: 1.17.0
  - systemtags: 1.19.0
  - tasks: 0.16.1
  - text: 3.10.1
  - theming: 2.4.0
  - twofactor_backupcodes: 1.18.0
  - updatenotification: 1.19.1
  - user_status: 1.9.0
  - viewer: 2.3.0
  - weather_status: 1.9.0
  - workflowengine: 2.11.0
Disabled:
  - admin_audit: 1.19.0
  - encryption: 2.17.0
  - spreed: 19.0.11 (installed 19.0.11)
  - suspicious_login: 7.0.0
  - twofactor_totp: 11.0.0-dev
  - user_ldap: 1.20.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"eKhJe8j51sFuomAOD60J","level":3,"time":"2024-12-25T10:26:35+00:00","remoteAddr":"91.89.167.224","user":"hab","app":"index","method":"GET","url":"/index.phpiew?fileId=46219&x=250&y=250","message":"Exception thrown: OCP\\Files\\GenericFileException","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0","version":"29.0.10.1","exception":{"Exception":"OCP\\Files\\GenericFileException","Message":"","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/SimpleFS/SimpleFile.php","line":74,"function":"getContent","class":"OC\\Files\\Node\\File","type":"->","args":[]},{"file":"/var/www/html/lib/public/AppFramework/Http/FileDisplayResponse.php","line":70,"function":"getContent","class":"OC\\Files\\SimpleFS\\SimpleFile","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":241,"function":"callback","class":"OCP\\AppFramework\\Http\\FileDisplayResponse","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Output"}]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"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":1060,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Files/Node/File.php","Line":56,"message":"","exception":[],"CustomMessage":"Exception thrown: OCP\\Files\\GenericFileException"},"id":"676bddf69c419"}

{"reqId":"eKhJe8j51sFuomAOD60J","level":3,"time":"2024-12-25T10:26:35+00:00","remoteAddr":"91.89.167.224","user":"hab","app":"PHP","method":"GET","url":"/index.phpiew?fileId=46219&x=250&y=250","message":"file_get_contents(/var/www/html/data/appdata_ocwflvc6mxkf/preview/b/b/f/9/6/d/e/46219/256-256-crop.png): Failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#331","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0","version":"29.0.10.1","data":{"app":"PHP"},"id":"676bddf69c427"}
Additional info

OS: Docker image (nextcloud:29-apache) on QNAP QTS (Linux 5.10.60-qnap x86_64)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the preview request through lib/private/Files/SimpleFS/SimpleFile.php, lib/public/AppFramework/Http/FileDisplayResponse.php, and lib/private/Files/Storage/Local.php, using the supplied stack trace and PreviewController route. Reproduce an upload to a shared folder and confirm that previews no longer produce GenericFileException or missing-file errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.