tasks
                                
                                 tasks copied to clipboard
                                
                                    tasks copied to clipboard
                            
                            
                            
                        Moving task between lists back and forth causes error
Steps to reproduce
- Create a task in some list A.
- Move the task to another list B.
- Move the task back to list A.
Expected behaviour
Task should be moved successfully from A to B and back to A.
Actual behaviour
Movement from A to B works, but trying to move back to A fails with a generic error message ("Es ist ein Fehler aufgetreten.").
This behavior appeared after the update from Nextcloud 21 to 22 with Tasks version 0.13.6 (it worked before the update). It did not change with Tasks version 0.14.0-alpha.1.
The Nextcloud log contains hints (see below).
Server configuration
Operating system: Linux 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64
Web server: Apache/2.4.38 (Debian) (apache2handler)
Database: mysql 10.5.11
PHP version: 7.4.21 Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, session, posix, Reflection, standard, SimpleXML, pdo_sqlite, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, apcu, bcmath, exif, gd, gmp, imagick, intl, ldap, memcached, pcntl, pdo_mysql, pdo_pgsql, redis, sodium, zip, Zend OPcache
Nextcloud version: 22.0.0 - 22.0.0.11
Tasks version: 0.14.0-alpha.1
Updated from an older Nextcloud or fresh install: updated from 21
List of activated apps:
Enabled:
- accessibility: 1.7.0
- activity: 2.15.0
- calendar: 2.3.0
- circles: 22.0.0
- cloud_federation_api: 1.4.0
- comments: 1.11.0
- contacts: 4.0.0
- contactsinteraction: 1.2.0
- dashboard: 7.1.0
- dav: 1.18.0
- deck: 1.5.0
- federatedfilesharing: 1.11.0
- federation: 1.11.0
- files: 1.16.0
- files_pdfviewer: 2.3.0
- files_rightclick: 1.1.0
- files_sharing: 1.13.2
- files_trashbin: 1.11.0
- files_versions: 1.14.0
- files_videoplayer: 1.11.0
- firstrunwizard: 2.11.0
- issuetemplate: 0.7.0
- logreader: 2.7.0
- lookup_server_connector: 1.9.0
- nextcloud_announcements: 1.11.0
- notes: 4.1.0
- notifications: 2.10.1
- oauth2: 1.9.0
- password_policy: 1.12.0
- photos: 1.4.0
- privacy: 1.6.0
- provisioning_api: 1.11.0
- recommendations: 1.1.0
- serverinfo: 1.12.0
- settings: 1.3.0
- sharebymail: 1.11.0
- support: 1.5.0
- survey_client: 1.10.0
- systemtags: 1.11.0
- tasks: 0.14.0-alpha.1
- text: 3.3.0
- theming: 1.12.0
- twofactor_backupcodes: 1.10.1
- updatenotification: 1.11.0
- user_status: 1.1.1
- viewer: 1.6.0
- weather_status: 1.1.0
- workflowengine: 2.3.0
Disabled:
- admin_audit
- bruteforcesettings
- encryption
- files_external
- qownnotesapi
- tasks_0.13.6
- user_ldap
Nextcloud configuration:
{
    "htaccess.RewriteBase": "\/",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "apps_paths": [
        {
            "path": "\/var\/www\/html\/apps",
            "url": "\/apps",
            "writable": false
        },
        {
            "path": "\/var\/www\/html\/custom_apps",
            "url": "\/custom_apps",
            "writable": true
        }
    ],
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "cloud.lan"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "22.0.0.11",
    "overwrite.cli.url": "https:\/\/cloud.lan",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "maintenance": false,
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpmode": "smtp",
    "mail_sendmailmode": "smtp",
    "mail_smtpsecure": "ssl",
    "mail_smtpauthtype": "LOGIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "465",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "overwriteprotocol": "https",
    "loglevel": 2,
    "default_phone_region": "DE",
    "app_install_overwrite": [
        "tasks",
        "qownnotesapi",
        "issuetemplate"
    ],
    "theme": ""
}
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0
Operating system: Linux Mint 20.1
CalDAV-clients: Mozilla Thunderbird, DAVx5
Logs
Nextcloud log (data/nextcloud.log)
...
{"reqId":"grnFWVRqzXbKjb9TNpOr","level":0,"time":"2021-07-13T06:09:51+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"PUT","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Activity generated for new calendar object in calendar 6","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"grnFWVRqzXbKjb9TNpOr","level":0,"time":"2021-07-13T06:09:51+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"PUT","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Reminders of calendar object of calendar 6 created","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"U00eiDKuhA5KSEMfcr7j","level":0,"time":"2021-07-13T06:09:58+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"MOVE","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Activity generated for new calendar object in calendar 7","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"U00eiDKuhA5KSEMfcr7j","level":0,"time":"2021-07-13T06:09:58+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"MOVE","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Reminders of calendar object of calendar 7 created","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"U00eiDKuhA5KSEMfcr7j","level":0,"time":"2021-07-13T06:09:58+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"MOVE","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Activity generated for a calendar object of calendar 6 that is moved to trash","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"U00eiDKuhA5KSEMfcr7j","level":0,"time":"2021-07-13T06:09:58+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"dav","method":"MOVE","url":"/remote.php/dav/calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Reminders of restored calendar object of calendar 6 deleted","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11"}
{"reqId":"FjqABiKh0KKQkwdfncMh","level":0,"time":"2021-07-13T06:10:03+00:00","remoteAddr":"172.18.0.2","user":"carsten","app":"webdav","method":"MOVE","url":"/remote.php/dav/calendars/carsten/heute-critical-now/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","message":"Deleted calendar object with uid already exists in this calendar collection.","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":"22.0.0.11","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Deleted calendar object with uid already exists in this calendar collection.","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/dav/lib/CalDAV/Calendar.php","line":199,"function":"createCalendarObject","class":"OCA\\DAV\\CalDAV\\CalDavBackend","type":"->","args":["6","8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Nextcloud Tasks v0.14.0\r\nBEGIN:VTODO\r\nUID:c5a94cb6-7045-4367-9457-099bf5590f4e\r\nCREATED:20210713T080950\r\nLAST-MODIFIED:20210713T080950\r\nDTSTAMP:20210713T080950\r\nSUMMARY:Task 1\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":307,"function":"createFile","class":"Sabre\\CalDAV\\Calendar","type":"->","args":["8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Nextcloud Tasks v0.14.0\r\nBEGIN:VTODO\r\nUID:c5a94cb6-7045-4367-9457-099bf5590f4e\r\nCREATED:20210713T080950\r\nLAST-MODIFIED:20210713T080950\r\nDTSTAMP:20210713T080950\r\nSUMMARY:Task 1\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":133,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\CalDAV\\CalendarObject"},{"__class__":"OCA\\DAV\\CalDAV\\Calendar"},"8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":163,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->","args":["calendars/carsten/heute-critical-now/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":612,"function":"move","class":"Sabre\\DAV\\Tree","type":"->","args":["calendars/carsten/heute-critical-now/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics","calendars/carsten/inbox-1/8FD42805-85C3-4B0B-8AC0-8FA21CAE7E14.ics"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:MOVE",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":332,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/CalDAV/CalDavBackend.php","Line":1286,"CustomMessage":"--"}}
...
Thanks a lot for this complete report. I can reproduce the behavior. The problem is the newly introduced trash bin for events and tasks in Nextcloud 22.
By default, tasks are not completely removed from the database anymore when getting deleted in the Tasks app (or any other client), but just get marked as deleted (so they are not shown anymore besides within the trash bin). When we now move tasks between lists, a leftover remains in the old list (a task marked as deleted). So moving the task back fails, because there already is one (just marked as deleted). Hence, the move fails.
I am not entirely sure what would be the best solution for this. There are probably multiple options:
- Move the task with {'X-NC-CalDAV-No-Trashbin': 1}header so no deleted task remains in the trash bin
- Move the task with overwrite = trueso deleted tasks get overwritten
- Adjust Nextcloud server so deleted tasks are by default overwritten without error
I currently favor option 1. as a quick fix we can do here in the Tasks app. But I think we should consider option 3. as well. Other clients will have the same problem with moving tasks. If they don't support the trash bin collection or are especially adjusted for NC server 22, moving tasks will be broken for them.
@ChristophWurst and @tcitworld for input, since you implemented the trash bin in server.
@ChristophWurst @tcitworld Moving events in Calendar between different calendars is currently also broken in the Calendar app v.2.3.0.
The server response is
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
  <s:message>Deleted calendar object with uid already exists in this calendar collection.</s:message>
</d:error>
@carhe Please see https://github.com/nextcloud/tasks/pull/1694 for the current status.
Since this will very likely require server-side fixes, I remove this from the next milestone.
Thanks for the update @raimund-schluessler. Is there any issue submitted to the nextcloud server project where we can track this?
@aharish No, I did not create a server ticket yet, because I wasn't sure if it is server issue. But since it's clear now, I guess we should create one (or just transfer this issue here to server). @ChristophWurst @tcitworld What do you think?
3 Adjust Nextcloud server so deleted tasks are by default overwritten without error
I'd strongly vote for this option, for the reasons already mentioned above.
I created a corresponding server issue: https://github.com/nextcloud/server/issues/30096
A fix for moving tasks between lists (back and forth) is here: https://github.com/nextcloud/server/pull/30120
I think this issue is a duplicate of https://github.com/nextcloud/calendar/issues/3325 and is now fixed with https://github.com/nextcloud/server/pull/30120.
This issue was fixed.