Error moving or renaming folders NCv12

Nextcloud version: 12.0.0
Operating system and version: Alpine Linux 3.6
Apache or nginx version: Nginx 1.13.1
PHP version: 7.1.5
Is this the first time you’ve seen this error?: No (only in 12.0.0)

Can you reliably replicate it? (If so, please outline steps):

I try to move a folder / or rename it

The issue you are facing:

Move failure / Rename failure

The output of your Nextcloud log in Admin > Logging:

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘UPDATE oc_filecache SET storage = ?, path_hash = MD5(CONCAT(?, SUBSTR(path, ?))), path = CONCAT(?, SUBSTR(path, ?)) WHERE (storage = ?) AND (path LIKE ?)’ with params [4, “files/\u0423\u043d\u0438\u0432\u0435\u0440/3 \u043a\u0443\u0440\u0441/_Done/\u0424\u0438\u0437\u0440\u0430”, 41, “files/\u0423\u043d\u0438\u0432\u0435\u0440/3 \u043a\u0443\u0440\u0441/_Done/\u0424\u0438\u0437\u0440\u0430”, 41, 4, “files/\u0423\u043d\u0438\u0432\u0435\u0440/3 \u043a\u0443\u0440\u0441/\u0424\u0438\u0437\u0440\u0430/%”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4-a94af5108d5b6274ef4dd6d5aa0c4fd7’ for key ‘fs_storage_path_hash’

and then

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘UPDATE oc_filecache SET storage = ?, path_hash = MD5(CONCAT(?, SUBSTR(path, ?))), path = CONCAT(?, SUBSTR(path, ?)) WHERE (storage = ?) AND (path LIKE ?)’ with params [4, “files_trashbin/files/\u0424\u0438\u0437\u0440\u0430.d1496598954”, 47, “files_trashbin/files/\u0424\u0438\u0437\u0440\u0430.d1496598954”, 47, 4, “files/\u0423\u043d\u0438\u0432\u0435\u0440/3 \u043a\u0443\u0440\u0441/\_Done/\u0424\u0438\u0437\u0440\u0430/%”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4-9c5afe57996360b82993a994e1499bb6’ for key ‘fs_storage_path_hash’`

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

<?php
$CONFIG = array (
  'datadirectory' => '/data',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),
  'instanceid' => '*value removed*',
  'passwordsalt' => '*value removed*',
  'secret' => '*value removed*',
  'trusted_domains' =>
  array (
    0 => 'cloud.*value removed*',
  ),
  'overwrite.cli.url' => 'http://cloud.*value removed*',
  'dbtype' => 'mysql',
  'version' => '12.0.0.29',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*value removed*',
  'dbpassword' => '*value removed*',
  'logtimezone' => 'Europe/Moscow',
  'installed' => true,
  'mail_from_address' => 'no-reply',
  'logdateformat' => 'Y-m-d H:i:s',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' =>
  array (
    'host' => 'redis',
    'port' => 6379,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_domain' => 'cloud.*value removed*',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'mx.*value removed*',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'no-reply@cloud.*value removed*',
  'mail_smtppassword' => '*value removed*',
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
);
1 Like

Duplicate entries are not good. You can rescan your user’s folder with the occ command:
https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html#file-operations

and then also cleanup the filecache.

Did you manually change files within the user’s folder (not via web-interface, Nextcloud client or webdav)?

This error repeated more than once today.

I didn’t move files manually.

After each movement of folder in the Web-UI, the same error occurs. It can be fixed by running commands:

  1. occ files:scan user
  2. maintenance:mimetype:update-db --repair-filecache

It looks more like a bug=(

Please log this as an issue on GitHub.

@LukasReschke @nickvergessen @jospoortvliet anyone seen this previously?

Google says that the terms are known…

Done. Issue #5448

1 Like