nextcloud / nextcloud/groupfolders

`Integrity constraint violation: 1062 Duplicate entry [..] for key 'groups_folder_trash_unique' `

Open
#2,466 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug feature: trashbin
Dominant language
PHP
Stars
343
Forks
106
Avg merge
2d 3h
Merged PRs (30d)
34

Description

I'm getting several error messages each day:

[webdav] Error: OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-RL11-1626 New Channel PO.pdf-1689338559' for key 'groups_folder_trash_unique' at <<closure>>

 0. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 328
    OC\DB\Exceptions\DbalException::wrap()
 1. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php line 57
    OC\DB\QueryBuilder\QueryBuilder->executeStatement()
 2. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php line 218
    OCA\GroupFolders\Trash\TrashManager->addTrashItem()
 3. /srv/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 102
    OCA\GroupFolders\Trash\TrashBackend->moveToTrash()
 4. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 202
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash()
 5. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 102
    OCA\Files_Trashbin\Storage->doDelete()
 6. /srv/nextcloud/lib/private/Files/View.php line 1182
    OCA\Files_Trashbin\Storage->unlink()
 7. /srv/nextcloud/lib/private/Files/View.php line 729
    OC\Files\View->basicOperation()
 8. /srv/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 536
    OC\Files\View->unlink()
 9. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\File->delete()
10. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
11. /srv/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
12. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
13. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
14. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
15. /srv/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
16. /srv/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
17. /srv/nextcloud/remote.php line 172
    require_once("/srv/nextcloud/ ... p")

Caused by:

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-RL11-1626 New Channel PO.pdf-1689338559' for key 'groups_folder_trash_unique' at <<closure>>

 0. /srv/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1814
    Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert()
 1. /srv/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1749
    Doctrine\DBAL\Connection->handleDriverException()
 2. /srv/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1163
    Doctrine\DBAL\Connection->convertExceptionDuringQuery()
 3. /srv/nextcloud/lib/private/DB/Connection.php line 295
    Doctrine\DBAL\Connection->executeStatement()
 4. /srv/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
    OC\DB\Connection->executeStatement()
 5. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
    Doctrine\DBAL\Query\QueryBuilder->execute()
 6. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
    OC\DB\QueryBuilder\QueryBuilder->execute()
 7. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php line 57
    OC\DB\QueryBuilder\QueryBuilder->executeStatement()
 8. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php line 218
    OCA\GroupFolders\Trash\TrashManager->addTrashItem()
 9. /srv/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 102
    OCA\GroupFolders\Trash\TrashBackend->moveToTrash()
10. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 202
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash()
11. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 102
    OCA\Files_Trashbin\Storage->doDelete()
12. /srv/nextcloud/lib/private/Files/View.php line 1182
    OCA\Files_Trashbin\Storage->unlink()
13. /srv/nextcloud/lib/private/Files/View.php line 729
    OC\Files\View->basicOperation()
14. /srv/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 536
    OC\Files\View->unlink()
15. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\File->delete()
16. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
17. /srv/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
18. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
19. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
20. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
21. /srv/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
22. /srv/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
23. /srv/nextcloud/remote.php line 172
    require_once("/srv/nextcloud/ ... p")

Caused by:

Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-RL11-1626 New Channel PO.pdf-1689338559' for key 'groups_folder_trash_unique' at <<closure>>

 0. /srv/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 103
    Doctrine\DBAL\Driver\PDO\Exception::new()
 1. /srv/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1153
    Doctrine\DBAL\Driver\PDO\Statement->execute()
 2. /srv/nextcloud/lib/private/DB/Connection.php line 295
    Doctrine\DBAL\Connection->executeStatement()
 3. /srv/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
    OC\DB\Connection->executeStatement()
 4. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
    Doctrine\DBAL\Query\QueryBuilder->execute()
 5. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
    OC\DB\QueryBuilder\QueryBuilder->execute()
 6. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php line 57
    OC\DB\QueryBuilder\QueryBuilder->executeStatement()
 7. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php line 218
    OCA\GroupFolders\Trash\TrashManager->addTrashItem()
 8. /srv/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 102
    OCA\GroupFolders\Trash\TrashBackend->moveToTrash()
 9. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 202
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash()
10. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 102
    OCA\Files_Trashbin\Storage->doDelete()
11. /srv/nextcloud/lib/private/Files/View.php line 1182
    OCA\Files_Trashbin\Storage->unlink()
12. /srv/nextcloud/lib/private/Files/View.php line 729
    OC\Files\View->basicOperation()
13. /srv/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 536
    OC\Files\View->unlink()
14. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\File->delete()
15. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
16. /srv/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
17. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
18. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
19. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
20. /srv/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
21. /srv/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
22. /srv/nextcloud/remote.php line 172
    require_once("/srv/nextcloud/ ... p")

Caused by:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-RL11-1626 New Channel PO.pdf-1689338559' for key 'groups_folder_trash_unique' at <<closure>>

 0. /srv/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 101
    PDOStatement->execute()
 1. /srv/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1153
    Doctrine\DBAL\Driver\PDO\Statement->execute()
 2. /srv/nextcloud/lib/private/DB/Connection.php line 295
    Doctrine\DBAL\Connection->executeStatement()
 3. /srv/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
    OC\DB\Connection->executeStatement()
 4. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
    Doctrine\DBAL\Query\QueryBuilder->execute()
 5. /srv/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
    OC\DB\QueryBuilder\QueryBuilder->execute()
 6. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php line 57
    OC\DB\QueryBuilder\QueryBuilder->executeStatement()
 7. /srv/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php line 218
    OCA\GroupFolders\Trash\TrashManager->addTrashItem()
 8. /srv/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 102
    OCA\GroupFolders\Trash\TrashBackend->moveToTrash()
 9. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 202
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash()
10. /srv/nextcloud/apps/files_trashbin/lib/Storage.php line 102
    OCA\Files_Trashbin\Storage->doDelete()
11. /srv/nextcloud/lib/private/Files/View.php line 1182
    OCA\Files_Trashbin\Storage->unlink()
12. /srv/nextcloud/lib/private/Files/View.php line 729
    OC\Files\View->basicOperation()
13. /srv/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 536
    OC\Files\View->unlink()
14. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\File->delete()
15. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
16. /srv/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
17. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
18. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
19. /srv/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
20. /srv/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
21. /srv/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
22. /srv/nextcloud/remote.php line 172
    require_once("/srv/nextcloud/ ... p")

DELETE /remote.php/dav/files/DEDACTED/Purchasing/Requisitions/11%20mv%20REDACTED/2023%20PO/RL11-1626%20New%20Channel%20PO.pdf
from 79.100.62.99 by REDACTED at 2023-07-14T12:42:39+00:00
Server configuration

Operating system:

Web server: Debian 11 / Linux 5.10.0-23-amd64 x86_64

Database: MariaDB / Version: 10.5.19

PHP version: 8.2.7

Nextcloud version: 26.0.3

Group folders version: 14.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/groupfolders/lib/Trash/TrashManager.php at line 57 and follow the call from TrashBackend.php line 218 during the reported WebDAV DELETE request. Reproduce the deletion with the listed Nextcloud 26.0.3, Group Folders 14.0.2, MariaDB 10.5.19, and PHP 8.2.7 versions. Done means the duplicate-entry error no longer occurs during this trash operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.