nextcloud / groupfolders

📁👩‍👩‍👧‍👦 Admin-configured folders shared by everyone in a group. https://github.com/nextcloud-releases/groupfolders
https://apps.nextcloud.com/apps/groupfolders
284 stars 87 forks source link

Cleanly handle assigning same group again via API #2180

Open beccon4 opened 1 year ago

beccon4 commented 1 year ago

Steps to reproduce

  1. use API to assign a group to an existing group folder
  2. send the same command again - now as the group has already been assigned
  3. see the error message

Expected behaviour

a XML return containing a proper error message

Actual behaviour

a weird html return crashing the XML parser

Server configuration

Operating system: Ubuntu 22.04

Web server: Apache

Database: MySQL

PHP version: 8.1

Nextcloud version: (see Nextcloud admin page) 25.0.1

Group folders version: 13.0.0

Updated from an older Nextcloud/ownCloud or fresh install: no - this is a test setup

Where did you install Nextcloud from: website

Are you using external storage, if yes which one: local/s3/smb/sftp/... no

Are you using encryption: yes/no no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/Saml/... no

Logs

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message>OK</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data>
  <success>1</success>
 </data>
</ocs>

OK - this works as expected but repeating the same request - now with the group yet assigned fails with this unusual return ...

<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="de" data-locale="de" >
    <head
 data-requesttoken="">
        <meta charset="utf-8">
        <title>
            Nextcloud       </title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
                <meta name="apple-itunes-app" content="app-id=1125420102">
                <meta name="theme-color" content="#0082c9">
        <link rel="icon" href="/nextcloud/core/img/favicon.ico">
        <link rel="apple-touch-icon" href="/nextcloud/core/img/favicon-touch.png">
        <link rel="mask-icon" sizes="any" href="/nextcloud/core/img/favicon-mask.svg" color="#0082c9">
        <link rel="manifest" href="/nextcloud/index.php/apps/theming/manifest?v=0">
        <link rel="stylesheet" href="/nextcloud/core/css/server.css?v=01aa42b5-0">
<link rel="stylesheet" href="/nextcloud/core/css/styles.css?v=01aa42b5-0">
<link rel="stylesheet" href="/nextcloud/core/css/header.css?v=01aa42b5-0">
<link rel="stylesheet" href="/nextcloud/apps/theming/css/default.css?v=47354877-0">
<link rel="stylesheet" href="/nextcloud/core/css/guest.css?v=01aa42b5-0">
        <script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/dist/core-common.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/dist/core-main.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/core/l10n/de.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/dist/core-files_fileinfo.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/dist/core-files_client.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/index.php/js/core/merged-template-prepend.js?v=01aa42b5-0"></script>
<script nonce="Z1o5SHlyTndVUW5rbDBDczV4dTUyL2FVVHJEbjZIMTdqNW10L3pCQmwzST06c1BSMXV1b1dOWHluMFFHRDNrejd1Si9nQzl5dDJpcyt4OXZjem1VQThBST0=" defer src="/nextcloud/dist/files_sharing-main.js?v=01aa42b5-0"></script>
            </head>
    <body id="body-login">
        <noscript>
    <div id="nojavascript">
        <div>
            Diese Anwendung benötigt JavaScript zum ordnungsgemäßen Betrieb. Bitte <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer noopener">aktiviere JavaScript</a> und lade die Seite neu.      </div>
    </div>
</noscript>
                    <input type="hidden" id="initial-state-comments-maxAutoCompleteResults" value="MTA=">
                <div class="wrapper">
            <div class="v-align">
                                    <header role="banner">
                        <div id="header">
                            <div class="logo">
                                <h1 class="hidden-visually">
                                    Nextcloud                               </h1>
                            </div>
                        </div>
                    </header>
                                <main>
                    <div class="guest-box wide">
    <h2>Interner Serverfehler</h2>
    <p>Der Server konnte die Anfrage nicht fertig stellen.</p>
    <p>Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an deinen Server-Administrator.</p>
    <p>Weitere Details können im Server-Protokoll gefunden werden.</p>

    <h3>Technische Details</h3>
    <ul>
        <li>Entfernte Adresse: 127.0.0.1</li>
        <li>Anfragekennung: 6B9jBGfLnGpTaJXjRecb</li>
            </ul>

    </div>
                </main>
            </div>
        </div>
        <footer role="contentinfo">
            <p class="info">
                <a href="https://nextcloud.com" target="_blank" rel="noreferrer noopener" class="entity-name">Nextcloud</a> – ein sicherer Ort für all deine Daten          </p>
        </footer>
    </body>
</html>
Web server error log ``` 127.0.0.1 - - [11/Nov/2022:10:45:35 +0100] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 782 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0" 127.0.0.1 - beccon [11/Nov/2022:10:45:43 +0100] "POST /nextcloud/index.php/apps/groupfolders/folders/56/groups HTTP/1.1" 500 5882 "-" "curl/7.81.0" ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` {"reqId":"FNnNhT2IXjVbIWdMdbDF","level":3,"time":"2022-11-11T09:42:06+00:00","remoteAddr":"127.0.0.1","user":"beccon4","app":"index","method":"POST","url":"/nextcloud/index.php/apps/groupfolders/folders/56/groups","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","userAgent":"curl/7.81.0","version":"25.0.1.1","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":329,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1173,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":60,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":94,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1163,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":"23000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":92,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1163,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":92}}},"CustomMessage":"--"}} ```
fschrempf commented 1 year ago

I don't know if this would solve the issue, but before fixing it we should probably move to the OCS API. See https://github.com/nextcloud/groupfolders/issues/1019 and https://github.com/nextcloud/groupfolders/pull/997.

joshtrichards commented 1 month ago

Key bit is here:

{"reqId":"FNnNhT2IXjVbIWdMdbDF","level":3,"time":"2022-11-11T09:42:06+00:00","remoteAddr":"127.0.0.1","user":"beccon4","app":"index","method":"POST","url":"/nextcloud/index.php/apps/groupfolders/folders/56/groups","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","userAgent":"curl/7.81.0","version":"25.0.1.1","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":329,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1173,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":60,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":1062,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":94,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1163,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '56-MigrationAdmins' for key 'groups_folder_group'","Code":"23000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":92,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1163,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":354,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":281,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":327,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php","line":592,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/groupfolders/lib/Controller/FolderController.php","line":111,"function":"addApplicableGroup","class":"OCA\\GroupFolders\\Folder\\FolderManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"addGroup","class":"OCA\\GroupFolders\\Controller\\FolderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":92}}},"CustomMessage":"--"}}

Likely just needs a check somewhere around here for the group before trying to add it:

https://github.com/nextcloud/groupfolders/blob/e9db97d86926a9d145504e71934d042d8bf2cdea/lib/Controller/FolderController.php#L187-L199