Theming errors on new install

Nextcloud version (eg, 12.0.2): 17.0.0
Operating system and version (eg, Ubuntu 17.04): (host) CoreOS 2191.5.0 -> (container) nextcloud:17.0-apache [Debian 10]
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38
PHP version (eg, 7.1): 7.3
That’s a new installation

The issue you are facing:
Issue regarding missing theming files:

  • text.svg
  • x-office-document.svg
  • video.svg
  • application-pdf.svg

Furthermore, trying to edit something via Admin>Theming results in no theme at all until restart.

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

Steps to replicate it:

  1. Editing in Admin>Theming results in a blank css

What I already tried:

  • chown www-data:root -R /var/www/html/
  • occ maintenance:repair

The output of your Nextcloud log in Admin > Logging:

[jsresourceloader] Error: Could not find resource js/config.js to load
GET /settings/user

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/theming/4fda-238a-theming.css.gzip): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/core/68b4-238a-css-variables.css): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/theming/4fda-238a-settings-admin.css): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/core/68b4-238a-css-variables.css.deps): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/core/68b4-238a-css-variables.css): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[PHP] Error: unlink(/var/www/html/data/appdata_octch82gmlv9/css/notifications/daf8-238a-styles.css): No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#228
POST /apps/theming/ajax/updateStylesheet

[index] Error: OCP\Files\NotPermittedException: Could not create folder at <<closure>>

 0. /var/www/html/lib/private/Files/AppData/AppData.php line 155
    OC\Files\Node\Folder->newFolder("1")
 1. /var/www/html/apps/theming/lib/ImageManager.php line 155
    OC\Files\AppData\AppData->newFolder("1")
 2. /var/www/html/apps/theming/lib/ImageManager.php line 170
    OCA\Theming\ImageManager->getCacheFolder()
 3. /var/www/html/apps/theming/lib/Controller/IconController.php line 87
    OCA\Theming\ImageManager->getCachedImage("icon-core-filetypes_application-pdf.svg")
 4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Theming\Controller\IconController->getThemedIcon("core", "filetypes/application-pdf.svg")
 5. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 6. /var/www/html/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 7. /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Theming\\C ... r", "getThemedIcon", OC\AppFramework\ ... {}, {app: "core",ima ... "})
 8. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({app: "core",ima ... "})
 9. /var/www/html/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {app: "core",ima ... "})
10. /var/www/html/lib/base.php line 1000
    OC\Route\Router->match("/apps/theming/i ... g")
11. /var/www/html/index.php line 42
    OC::handleRequest()

GET /apps/theming/img/core/filetypes/application-pdf.svg?v=1

[index] Error: OCP\Files\NotPermittedException: Could not create folder at <<closure>>

 0. /var/www/html/lib/private/Files/AppData/AppData.php line 155
    OC\Files\Node\Folder->newFolder("1")
 1. /var/www/html/apps/theming/lib/ImageManager.php line 155
    OC\Files\AppData\AppData->newFolder("1")
 2. /var/www/html/apps/theming/lib/ImageManager.php line 170
    OCA\Theming\ImageManager->getCacheFolder()
 3. /var/www/html/apps/theming/lib/Controller/IconController.php line 87
    OCA\Theming\ImageManager->getCachedImage("icon-core-filetypes_video.svg")
 4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Theming\Controller\IconController->getThemedIcon("core", "filetypes/video.svg")
 5. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 6. /var/www/html/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 7. /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Theming\\C ... r", "getThemedIcon", OC\AppFramework\ ... {}, {app: "core",ima ... "})
 8. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({app: "core",ima ... "})
 9. /var/www/html/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {app: "core",ima ... "})
10. /var/www/html/lib/base.php line 1000
    OC\Route\Router->match("/apps/theming/i ... g")
11. /var/www/html/index.php line 42
    OC::handleRequest()

GET /apps/theming/img/core/filetypes/video.svg?v=1

[index] Error: OCP\Files\NotPermittedException: Could not create folder at <<closure>>

 0. /var/www/html/lib/private/Files/AppData/AppData.php line 155
    OC\Files\Node\Folder->newFolder("1")
 1. /var/www/html/apps/theming/lib/ImageManager.php line 155
    OC\Files\AppData\AppData->newFolder("1")
 2. /var/www/html/apps/theming/lib/ImageManager.php line 170
    OCA\Theming\ImageManager->getCacheFolder()
 3. /var/www/html/apps/theming/lib/Controller/IconController.php line 87
    OCA\Theming\ImageManager->getCachedImage("icon-core-filetypes_text.svg")
 4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Theming\Controller\IconController->getThemedIcon("core", "filetypes/text.svg")
 5. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 6. /var/www/html/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 7. /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Theming\\C ... r", "getThemedIcon", OC\AppFramework\ ... {}, {app: "core",ima ... "})
 8. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({app: "core",ima ... "})
 9. /var/www/html/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {app: "core",ima ... "})
10. /var/www/html/lib/base.php line 1000
    OC\Route\Router->match("/apps/theming/i ... g")
11. /var/www/html/index.php line 42
    OC::handleRequest()

GET /apps/theming/img/core/filetypes/text.svg?v=1

[index] Error: OCP\Files\NotPermittedException: Could not create folder at <<closure>>

 0. /var/www/html/lib/private/Files/AppData/AppData.php line 155
    OC\Files\Node\Folder->newFolder("1")
 1. /var/www/html/apps/theming/lib/ImageManager.php line 155
    OC\Files\AppData\AppData->newFolder("1")
 2. /var/www/html/apps/theming/lib/ImageManager.php line 170
    OCA\Theming\ImageManager->getCacheFolder()
 3. /var/www/html/apps/theming/lib/Controller/IconController.php line 87
    OCA\Theming\ImageManager->getCachedImage("icon-core-filet ... g")
 4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Theming\Controller\IconController->getThemedIcon("core", "filetypes/x-office-document.svg")
 5. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 6. /var/www/html/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Theming\Controller\IconController {}, "getThemedIcon")
 7. /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Theming\\C ... r", "getThemedIcon", OC\AppFramework\ ... {}, {app: "core",ima ... "})
 8. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({app: "core",ima ... "})
 9. /var/www/html/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {app: "core",ima ... "})
10. /var/www/html/lib/base.php line 1000
    OC\Route\Router->match("/apps/theming/i ... g")
11. /var/www/html/index.php line 42
    OC::handleRequest()

GET /apps/theming/img/core/filetypes/x-office-document.svg?v=1

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

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  '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,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '***',
    'port' => 6379,
    'password' => false,
  ),
  'instanceid' => '***',
  'overwriteprotocol' => 'https',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => '***',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '17.0.0.9',
  'overwrite.cli.url' => 'https://***',
  'dbname' => '***',
  'dbhost' => '***',
  'dbport' => '',
  'dbtableprefix' => '***',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'maintenance' => false,
);

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

relevant access.log entries
"GET /apps/theming/img/core/filetypes/text.svg?v=1 HTTP/1.0" 500 6124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/img/core/filetypes/x-office-document.svg?v=1 HTTP/1.0" 500 6124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/img/core/filetypes/video.svg?v=1 HTTP/1.0" 500 6124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/img/core/filetypes/application-pdf.svg?v=1 HTTP/1.0" 500 6124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/styles?reload=1570701914693 HTTP/1.0" 404 12864 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/styles?v=4 HTTP/1.0" 404 12864 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /css/core/68b4-238a-css-variables.css?v=19a870cf0756dad479442dd20dad29e5-da7df667-4 HTTP/1.0" 404 12939 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /css/core/68b4-238a-server.css?v=19a870cf0756dad479442dd20dad29e5-da7df667-4 HTTP/1.0" 404 12939 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /css/settings/68b4-238a-settings.css?v=19a870cf0756dad479442dd20dad29e5-da7df667-4 HTTP/1.0" 404 12939 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /css/core/68b4-238a-results.css?v=19a870cf0756dad479442dd20dad29e5-da7df667-4 HTTP/1.0" 404 12939 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /css/notifications/daf8-238a-styles.css?v=19a870cf0756dad479442dd20dad29e5-daf82050-4 HTTP/1.0" 404 12939 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
"GET /apps/theming/styles?v=4 HTTP/1.0" 404 12864 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

occ app:list

Enabled:
  - accessibility: 1.3.0
  - activity: 2.10.1
  - bruteforcesettings: 1.4.0
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - dav: 1.13.0
  - federatedfilesharing: 1.7.0
  - federation: 1.7.0
  - files: 1.12.0
  - files_pdfviewer: 1.6.0
  - files_rightclick: 0.15.1
  - files_sharing: 1.9.0
  - files_trashbin: 1.7.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - gallery: 18.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - nextcloud_announcements: 1.6.0
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - password_policy: 1.7.0
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - recommendations: 0.5.0
  - serverinfo: 1.7.0
  - sharebymail: 1.7.0
  - support: 1.0.1
  - survey_client: 1.5.0
  - systemtags: 1.7.0
  - text: 1.1.0
  - theming: 1.8.0
  - twofactor_backupcodes: 1.6.0
  - updatenotification: 1.7.0
  - viewer: 1.1.0
  - workflowengine: 1.7.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - user_ldap

same here. but a reload of the page fixes the problem.
looks like some read/write permission problems by nextcloud.

From time to time i also get, some “internal server error” on the login sceen, but a reload also saves this issue.

My errors is slightly different:

[PHP] Error: stat(): stat failed for /var/www/nextcloud/data/appdata_oco11qauqup9/css/core/1abd-5386-css-variables.css at /var/www/nextcloud/lib/private/Files/Storage/Local.php#143

GET /index.php/settings/user
from 195.202.151.xxx by admin at 2019-11-13T14:56:20+00:00

and also:

[index] Error: OCP\Files\NotFoundException: File does not exist at <<closure>>

 0. /var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php line 108
    OC\Files\SimpleFS\SimpleFile->checkFile()
 1. /var/www/nextcloud/lib/private/Template/SCSSCacher.php line 347
    OC\Files\SimpleFS\SimpleFile->putContent(":root{--color-m ... }")
 2. /var/www/nextcloud/lib/private/Template/SCSSCacher.php line 181
    OC\Template\SCSSCacher->cache("/var/www/nextcloud/core/css", "1abd-5386-css-variables.css", "css-variables.scss", OC\Files\SimpleFS\SimpleFolder {}, "/core/css")
 3. /var/www/nextcloud/lib/private/Template/CSSResourceLocator.php line 109
    OC\Template\SCSSCacher->process("/var/www/nextcloud", "core/css/css-variables.scss", "core")
 4. /var/www/nextcloud/lib/private/Template/CSSResourceLocator.php line 61
    OC\Template\CSSResourceLocator->cacheAndAppendScssIfExist("/var/www/nextcloud", "core/css/css-variables.scss")
 5. /var/www/nextcloud/lib/private/Template/ResourceLocator.php line 78
    OC\Template\CSSResourceLocator->doFind("css/css-variables")
 6. /var/www/nextcloud/lib/private/TemplateLayout.php line 295
    OC\Template\ResourceLocator->find(["css/server","c ... "])
 7. /var/www/nextcloud/lib/private/TemplateLayout.php line 200
    OC\TemplateLayout::findStylesheetFiles(["css/server","c ... "])
 8. /var/www/nextcloud/lib/private/legacy/template.php line 183
    OC\TemplateLayout->__construct("user", "settings")
 9. /var/www/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php line 160
    OC_Template->fetchPage({forms: {persona ... "})
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 119
    OCP\AppFramework\Http\TemplateResponse->render()
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 126
    OC\AppFramework\Http\Dispatcher->dispatch(OC\Settings\Cont ... {}, "index")
12. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OC\\Settings\\C ... r", "index", OC\AppFramework\ ... {}, {section: "perso ... "})
13. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({section: "perso ... "})
14. /var/www/nextcloud/lib/private/Route/Router.php line 297
    undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {section: "perso ... "})
15. /var/www/nextcloud/lib/base.php line 975
    OC\Route\Router->match("/settings/user")
16. /var/www/nextcloud/index.php line 42
    OC::handleRequest()

GET /index.php/settings/user
from 195.202.151.xxx by admin at 2019-11-13T14:56:20+00:00

since update from 16.0.5 to 16.0.6