Could not create folder, false error?

Nextcloud version: 17.0.1
Operating system: Ubuntu 18.04.3 LTS (Standard LAMP install)
Apache version: 2.4.29
PHP version: 7.2.24
MySQL version: 5.7.28

I have made a fresh install Ubuntu LAMP with latest Nextcloud manual install. I run Nextcloud as the only “site” on the server and use the default /var/www/html as web root. The files are owned by www-data:www-data and all other file and folder permissions has been set as per recommendations to the manual. I have applied all recommendations in the “Overview” tab in the admin panel. I have my primary Nextcloud storage configured to use a CIFS share mounted in /mnt/nextcloud, also set with recommended file and folder owner and permissions. The server and the Nextcloud instance is running perfect.

My CIFS mount in fstab:

//servername/nextcloud /mnt/nextcloud  cifs    vers=3.0,iocharset=utf8,gid=33,dir_mode=0770,credentials=/root/smbcredentials,uid=33    0       0

My Nexcloud config has some adjustments, but is minimal:

root@nextcloud:/var/www/html/config# cat config.php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXXXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
  'datadirectory' => '/mnt/nextcloud/',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://XXXXXXXXXXXXXXXXXXX:8443',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin',
  'dbpassword' => 'XXXXXXXXXXXXXXXXXXX',
  'installed' => true,
  'filesystem_check_changes' => 1,
  'filelocking.enabled' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwriteprotocol' => 'https',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'smtp.XXXXXXXXXXXXXXXXXXX',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'XXXXXXXXXXXXXXXXXXX',
  'mail_domain' => 'XXXXXXXXXXXXXXXXXXX',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXXXXXXXXXXXXXXXXXX',
  'mail_smtppassword' => 'XXXXXXXXXXXXXXXXXXX',

The issue you are facing:

The warnings I get in my Nextcloud admin log (see full error below), indicates that there was an error to create a new folder. This error is generated in my log every now and then when I scroll through a folder with thousands if photos, using the gallery preview on my iPhone. Upon investigation, the folder that is indicated in the error, is the preview cache folders that is auto generated in AppData. I double checked the permissions, and they are set correct. How ever, I also noticed that the cache folder already has thousands of successfully auto generated folders, including the one that the error log indicated couldn’t be created. So somewhere the generation of folders tries to create duplicates, or there’s some other bug in the process of checking and creating the folders.

Steps to replicate it:

  1. Add a folder with thousands of photos to your user storage.
  2. Using the Nextcloud app on an iPhone, fast scroll down the gallery app with an occasional pause for the previews to show on screen.
  3. Check admin GUI error log for “OCP\Files\NotPermittedException”

The output of your Nextcloud log in Admin > Logging:

	OCP\Files\NotPermittedException: Could not create folder
/var/www/html/lib/private/Files/AppData/AppData.php - line 155:


/var/www/html/lib/private/Preview/Generator.php - line 432:


/var/www/html/lib/private/Preview/Generator.php - line 118:

OC\Preview\Generator->getPreviewFolder(OC\Files\Node\File {})

/var/www/html/lib/private/PreviewManager.php - line 210:

OC\Preview\Generator->getPreview(OC\Files\Node\File {}, 281, 609, false, "cover", "image/jpeg")

/var/www/html/core/Controller/PreviewController.php - line 170:

OC\PreviewManager->getPreview(OC\Files\Node\File {}, 281, 609, false, "cover")

/var/www/html/core/Controller/PreviewController.php - line 105:

OC\Core\Controller\PreviewController->fetchPreview(OC\Files\Node\File {}, 281, 609, true, true, "cover")

/var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OC\Core\Controller\PreviewController->getPreview("Data/photos ... G", 281, 609, true, true, "cover")

/var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Cont ... {}, "getPreview")

/var/www/html/lib/private/AppFramework/App.php - line 126:

OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Cont ... {}, "getPreview")

/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OC\\Core\\C ... r", "getPreview", OC\AppFramew ... {}, { _route: "c ... "})


OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "c ... "})

/var/www/html/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew ... {}, { _route: "c ... "})

/var/www/html/lib/base.php - line 1000:


/var/www/html/index.php - line 42:


Thankful for any suggestions and advice.

A little bump to this one. I’ve been at it for hours yesterday and can’t seem to find what the issue is.

EDIT: This was NOT the solution, still the same error.
Soo… I have solved this one after extensive testing. If anyone has this exact same error, look in your linux system log if you also see “cifs vfs free previous auth_key.response”. The “permission” error occurred at the same time as I get the CIFS error. This seems to be related to SMB mounts using SMB version 3.02 (which is default in ubuntu 18.04 of left unconfigured) Try set version 2.0 or 3.0 instead. This worked for me.

May have spoke too soon. The error is still there, so above “solution” is not it…

Several patches later I still have this error. Too bad this forum is dead :confused:

It is really dead… I have a same sort of issue, but no clear solution.

I’m just gonna ditch nextcloud and get a proper storage system that has actual support.

1 Like