RuntimeException Could not get appdata folder for preview

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud Hub 7 (28.0.3)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 23.10
Docker version: 25.0.3
Docker images: ‘nginx and mariadb:10.6’
PHP version (eg, 7.4): 8.2.16

The issue you are facing:

Is this the first time you’ve seen this error? (Y):

Steps to replicate it:

  1. Create VM of Ubuntu 23.10 minimal on proxmox
  2. Install docker and docker compose plugin
  3. run docker compose up -d with the nextcloud:fpm image, nginx, mariadb and a cron image as well.

The output of your Nextcloud log in Admin > Logging:

{
  "reqId": "ajGEpT5SJ4pSyb1cd5Gl",
  "level": 3,
  "time": "2024-03-07T16:43:03+00:00",
  "remoteAddr": "10.30.2.201",
  "user": "compukid",
  "app": "index",
  "method": "GET",
  "url": "/core/preview?fileId=49&x=256&y=256&c=76b16b7a7459fc9bab9390be2b403d9e",
  "message": "Could not get appdata folder for preview",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
  "version": "28.0.3.2",
  "exception": {
    "Exception": "RuntimeException",
    "Message": "Could not get appdata folder for preview",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/Files/AppData/AppData.php",
        "line": 147,
        "function": "getAppDataFolder",
        "class": "OC\\Files\\AppData\\AppData",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/lib/private/Preview/Storage/Root.php",
        "line": 74,
        "function": "newFolder",
        "class": "OC\\Files\\AppData\\AppData",
        "type": "->",
        "args": [
          "f/4/5/7/c/5/4/49"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Preview/Generator.php",
        "line": 607,
        "function": "newFolder",
        "class": "OC\\Preview\\Storage\\Root",
        "type": "->",
        "args": [
          "49"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Preview/Generator.php",
        "line": 133,
        "function": "getPreviewFolder",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          [
            "OC\\Files\\Node\\File"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/Preview/Generator.php",
        "line": 110,
        "function": "generatePreviews",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          [
            "OC\\Files\\Node\\File"
          ],
          [
            [
              256,
              256,
              true,
              "fill"
            ]
          ],
          "image/png"
        ]
      },
      {
        "file": "/var/www/html/lib/private/PreviewManager.php",
        "line": 187,
        "function": "getPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          [
            "OC\\Files\\Node\\File"
          ],
          256,
          256,
          true,
          "fill",
          null
        ]
      },
      {
        "file": "/var/www/html/core/Controller/PreviewController.php",
        "line": 173,
        "function": "getPreview",
        "class": "OC\\PreviewManager",
        "type": "->",
        "args": [
          [
            "OC\\Files\\Node\\File"
          ],
          256,
          256,
          true,
          "fill"
        ]
      },
      {
        "file": "/var/www/html/core/Controller/PreviewController.php",
        "line": 141,
        "function": "fetchPreview",
        "class": "OC\\Core\\Controller\\PreviewController",
        "type": "->",
        "args": [
          [
            "OC\\Files\\Node\\File"
          ],
          256,
          256,
          false,
          true,
          "fill",
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "getPreviewByFileId",
        "class": "OC\\Core\\Controller\\PreviewController",
        "type": "->",
        "args": [
          49,
          256,
          256,
          false,
          true,
          "fill",
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OC\\Core\\Controller\\PreviewController"
          ],
          "getPreviewByFileId"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OC\\Core\\Controller\\PreviewController"
          ],
          "getPreviewByFileId"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OC\\Core\\Controller\\PreviewController",
          "getPreviewByFileId",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "core.Preview.getPreviewByFileId"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/core/preview"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/Files/AppData/AppData.php",
    "Line": 108,
    "message": "Could not get appdata folder for preview",
    "exception": [],
    "CustomMessage": "Could not get appdata folder for preview"
  },
  "id": "65eb1a3b34014"
}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'upgrade.disable-web' => true,
  'instanceid' => 'oc8p86z3au4v',
  'passwordsalt' => 'N/A',
  'secret' => 'N/A',
  'trusted_domains' => 
  array (
    0 => 'my.domain.com',
    1 => '10.30.2.202:8180',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '28.0.3.2',
  'overwrite.cli.url' => 'https://my.domain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'N/A',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'maintenance_window_start' => 2,
  'default_phone_region' => 'US',
  'enable_previews' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

Having trouble getting nginx log. When I run the cat or tail command in docker it hangs until I hit CTRL+C to escape with no output. 

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
{"reqId":"pSe05Xef1KD2ygshEOeF","level":3,"time":"2024-03-07T16:42:36+00:00","remoteAddr":"10.30.2.201","user":"compukid","app":"index","method":"GET","url":"/apps/theming/icon?v=0","message":"Could not create folder \"/appdata_oc8p86z3au4v/theming/global\"","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36","version":"28.0.3.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create folder \"/appdata_oc8p86z3au4v/theming/global\"","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/AppData/AppData.php","line":147,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->","args":["global"]},{"file":"/var/www/html/apps/theming/lib/ImageManager.php","line":367,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->","args":["global"]},{"file":"/var/www/html/apps/theming/lib/ImageManager.php","line":101,"function":"getRootFolder","class":"OCA\\Theming\\ImageManager","type":"->","args":[]},{"file":"/var/www/html/apps/theming/lib/Controller/IconController.php","line":176,"function":"getImage","class":"OCA\\Theming\\ImageManager","type":"->","args":["favicon"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getTouchIcon","class":"OCA\\Theming\\Controller\\IconController","type":"->","args":["core"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Theming\\Controller\\IconController"],"getTouchIcon"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Theming\\Controller\\IconController"],"getTouchIcon"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Theming\\Controller\\IconController","getTouchIcon",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["core","theming.Icon.getTouchIcon"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/theming/icon"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Files/Node/Folder.php","Line":162,"message":"Could not create folder \"/appdata_oc8p86z3au4v/theming/global\"","exception":{},"CustomMessage":"Could not create folder \"/appdata_oc8p86z3au4v/theming/global\""}}
{"reqId":"ajGEpT5SJ4pSyb1cd5Gl","level":3,"time":"2024-03-07T16:43:03+00:00","remoteAddr":"10.30.2.201","user":"compukid","app":"index","method":"GET","url":"/core/preview?fileId=49&x=256&y=256&c=76b16b7a7459fc9bab9390be2b403d9e","message":"Could not get appdata folder for preview","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36","version":"28.0.3.2","exception":{"Exception":"RuntimeException","Message":"Could not get appdata folder for preview","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/AppData/AppData.php","line":147,"function":"getAppDataFolder","class":"OC\\Files\\AppData\\AppData","type":"->","args":[]},{"file":"/var/www/html/lib/private/Preview/Storage/Root.php","line":74,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->","args":["f/4/5/7/c/5/4/49"]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":607,"function":"newFolder","class":"OC\\Preview\\Storage\\Root","type":"->","args":["49"]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":133,"function":"getPreviewFolder","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\Node\\File"]]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":110,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\Node\\File"],[[256,256,true,"fill"]],"image/png"]},{"file":"/var/www/html/lib/private/PreviewManager.php","line":187,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\Node\\File"],256,256,true,"fill",null]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":173,"function":"getPreview","class":"OC\\PreviewManager","type":"->","args":[["OC\\Files\\Node\\File"],256,256,true,"fill"]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":141,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[["OC\\Files\\Node\\File"],256,256,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[49,256,256,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OC\\Core\\Controller\\PreviewController"],"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OC\\Core\\Controller\\PreviewController"],"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\PreviewController","getPreviewByFileId",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["core.Preview.getPreviewByFileId"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Files/AppData/AppData.php","Line":108,"message":"Could not get appdata folder for preview","exception":{},"CustomMessage":"Could not get appdata folder for preview"}}

I would like to clean up the errors on the nextcloud log and not sure how. I did see similar issues to mine. One solution was a permission issue and I confirmed the app image has all files owned by www-data and still didn’t fix the issue. Not sure what else it could be.

1 Like

:man_facepalming: :man_facepalming: :man_facepalming:

I’m sorry, I made a few changes and the errors were still there, but after I submitted the post I realized the error showed an earlier date. I cleared the log restarted and so for no error. I think this can be closed. Sorry for redundancy I am getting used to NC.