'An Unknown Error has Occured' when cancelling large file(s) upload

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, 18.0.2): 19.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04LTS (Up-to-date)
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.1): 7.4.8

The issue you are facing: When uploading large files, anything over 10mb, it’ll have errors if I cancel during upload. This happens with Video files more easily than images. The side will say “Upload Cancelled” but the upload bar doesn’t go away and is stuck frozen. As soon as the “Upload Cancelled” box disappears, the side is then filled with 5-8 “An Unknown Error occurred”.

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

Steps to replicate it:

  1. Upload a bunch of videos over 10mb, try over 100mb
  2. Cancel at beginning or middle of upload
  3. You’ll see the bar freeze and a “Upload cancelled” box, wait for a bit, than a bunch of boxes saying “An Unknown error occurred” shall appear

The output of your Nextcloud log in Admin > Logging:

{"reqId":"K6NTzSsQSH3gTRoK3qJN","level":4,"time":"2020-07-22T10:19:54+00:00","remoteAddr":"127.0.0.1","user":"harveytj03","app":"webdav","method":"PUT","url":"/remote.php/dav/uploads/harveytj03/web-file-upload-1ca9939db83c595bfd3d7e345a42e426-1595413168331/10485760","message":{"Exception":"Sabre\\DAV\\Exception","Message":"Could not rename part file to final file","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":154,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":46,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1104,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":527,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":474,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":319,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":320,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":167,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":288,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"19.0.1.1","id":"5f181408d0f97"}

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

<?php
$CONFIG = array (
  //General
  'maintenance' => false,
  'installed' => true,
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'datadirectory' => '/drives/raid/nextcloud',
  //Session
  'session_lifetime' => 86400,
  'session_keepalive' => true,
  //Domain & Proxies
  'overwrite.cli.url' => 'xxx',
  'overwritehost' => 'xxx',
  'trusted_domains' => 
  array (
    0 => '0.0.0.0:3041',
    1 => 'xxx',
  ),
  'trusted_proxies' => 
  array (
    0 => '0.0.0.0',
  ),
  //Memory & Filelocking
  'filesystem_check_changes' => 1,
  'filelocking.enabled' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-nextcloud.sock',
    'port' => 0,
  ),
  //Database
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  //Mail Server
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '465',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'xxx',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  //Logs
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'logfilemode' => 416,
  'loglevel' => 2,
  //Preview and Thumbnails
  'enable_previews' => true,
  'preview_max_x' => 1024,
  'preview_max_y' => 1024,
  'preview_max_filesize_image' => 20,
  //Security
  'auth.bruteforce.protection.enabled' => true,
);

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

{"reqId":"Kam5mbFnf02Tx2kMi5BT","level":3,"time":"2020-07-22T08:34:43+00:00","remoteAddr":"127.0.0.1","user":"harveytj03","app":"core","method":"PUT","url":"/remote.php/dav/uploads/harveytj03/web-file-upload-d1b3a4980d529e37d1eca90ac5df8861-1595406861465/0","message":"unable to rename, source directory is not writable : uploads/web-file-upload-d1b3a4980d529e37d1eca90ac5df8861-1595406861465","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"19.0.1.1"}
{"reqId":"Kam5mbFnf02Tx2kMi5BT","level":3,"time":"2020-07-22T08:34:43+00:00","remoteAddr":"127.0.0.1","user":"harveytj03","app":"webdav","method":"PUT","url":"/remote.php/dav/uploads/harveytj03/web-file-upload-d1b3a4980d529e37d1eca90ac5df8861-1595406861465/0","message":"renaming part file to final file failed $renameOkay: false, $fileExists: false)","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"19.0.1.1"}
{"reqId":"Kam5mbFnf02Tx2kMi5BT","level":4,"time":"2020-07-22T08:34:43+00:00","remoteAddr":"127.0.0.1","user":"harveytj03","app":"webdav","method":"PUT","url":"/remote.php/dav/uploads/harveytj03/web-file-upload-d1b3a4980d529e37d1eca90ac5df8861-1595406861465/0","message":{"Exception":"Sabre\\DAV\\Exception","Message":"Could not rename part file to final file","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":154,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":46,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1104,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":527,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":474,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":319,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":320,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":167,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":288,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"19.0.1.1"}

I have done multiple new installs on different hardware configurations that all result in the same.
I believe changing the ‘max_chunk_size’ does not help as it does stop the errors but soon causes a group of new problems such as ‘NotFoundError’ being used everytime it can’t upload a file/folder. I have also used both the Apache module PHP and FPM with no difference too. This problem has been plaguing my install.

Perhaps you can test with a demo account (https://try.nextcloud.com) or a free account (https://nc.nl.tab.digital) to check the client or your network is not the problem.

Please read this settings.

https://docs.nextcloud.com/server/19/admin_manual/configuration_files/big_file_upload_configuration.html

"message":"unable to rename, source directory is not writable 

But here is also a temp-file. Perhaps there is a problem.

I have tried out the demo of Nextcloud and it had similar results. This time, the progress bar will continue to go and says its still uploading but than suddenly stop and show the same amount of errors.
Unfortunately since its a demo, I can’t look at the logs. Also, this could be the chunk size but I’m also having a odd issue of it doing 10mb at a time before freezing for a good 2 seconds and repeat

But than it is not a problem of your nextcloud but a problem of your client or network.

Can you use another client?
Can you use another network?
Can you use another browser?

Can you find the real problem?

So I’ve looked over the document just to make sure that I didn’t miss something and I turned off the ‘output_buffering’ and its seems to be fixed. However the progress bar is now stuck until I refresh. This is within the web UI of nextcloud. Webdav, while having some of its own issues, but otherwise it is working fine along with the Nextcloud Client for windows.

So I want to put that disabling or changing the ‘max_chunk_size’ to either ‘size’ or 0 has also helped. I want to put this out for anyone else dealing with this said issue.

Set ‘output_buffering’ in your php.ini (I would do both for apache2 and fpm) to 0.
Than go into terminal, go to the directory of your nextcloud, and than type “sudo -u www-data php occ config:app:set files max_chunk_size --value [size]”, replace [size] with any number for the chunk size, something like 524288000. Nextcloud does not recommend disabling max_chunk_size, aka set it to 0, UNLESS you have a beefy setup, network, and configurations in server.

1 Like