Error Unable to sync file with a certain name

Nextcloud version (eg, 20.0.5): 24
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.53
PHP version (eg, 7.4): 8.0.18

The issue you are facing:

I was uploading 27GB of photos using my pc with nextcloud client 3.5 installed. the photos are around 17MB each but I have smaller or large ones. One of the photos for some reason just gave this error out of the blue and I was seeing “connection closed” for this particular photo on the nextcloud client. The other photos uploaded without a hitch. This particular photos is 7.3MB.

I tries uploading the photo through the web interface but I get this error ‘ Error while copying file to target location (copied: -1 bytes, expected filesize: 7627145 bytes’. I tried upload the same file with a different name and it uploads and then I tried renaming it to the original name of the photo and I get an error and does not let me rename it. I tried uplaoading from the phone and another pc to no avail.

How can I fix this? Is this a problem with the database?

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

The output of your Nextcloud log in Admin > Logging:

Fatal	Sabre\DAV\Exception: Error while copying file to target location (copied: -1 bytes, expected filesize: 7627145 bytes)
Error	Sabre\DAV\Exception: Error while copying file to target location (copied: -1 bytes, expected filesize: 7627145 bytes)
Error	Error: file_put_contents(/mnt/sdcard/photos/xxxxxx.jpg.ocTransferId341447024.part): Failed to open stream: Invalid argument at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#29

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


<?php
$CONFIG = array (
  'instanceid' => 'XXXXX',
  'passwordsalt' => 'XXXX',
  'secret' => 'XXXX',
  'trusted_domains' =>
  array (
    0 => 'XXX',
    1 => 'XXX',
  ),
  'datadirectory' => '/home/Nextcloud',
  'dbtype' => 'mysql',
  'version' => '24.0.0.12',
  'overwrite.cli.url' => https://mydomain.com/nextcloud
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'htaccess.RewriteBase' => 'mydomain.com/nextcloud',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'maintenance' => false,
  'app_install_overwrite' =>
  array (
    0 => 'files_readmemd',
  ),
  'updater.secret' => 'XXX',
  'theme' => '',
  'loglevel' => 2,
);

I guess, that you have special chars like < > ? " : | \ / *.’ in the file name. - They are not allowed.

It does not have any special charcaters. That was my first thought when it happened at first
I changed the name just added a number at the end and did not change the rest and it uploaded. Then I tried renaming it to the original file name and it failed again

I solved it the special characters the you listed and that are listed in some other documentations that I looked at are not exhaustive. The file had the following letter “ċ” which is a common letter in my language and usually it does not give me any problems and to be fair I think it isn’t classified as a special character. So I am not sure if maybe this is a bug in nextcloud. But I am glad I managed to solve it cause it was driving me mad.

I am not familiar with the charsets. I may deped on the settings in the config-php. As far as I know there is a section about that in the Nextcloud documentation under https://docs.nextcloud.com/