Nextcloud 15.0.2. update - File Upload impossbile - File entry could not be inserted

Hi nextcloud users, I’ve been a long reader of tis great forum and now I seem to have an unknown problem (as far as I can use google).


Nextcloud version 15.0.0.2.
Operating system and version Linux dd41124 4.4.0-141-generic #167-Ubuntu SMP Wed Dec 5 10:40:15 UTC 2018x86_64 (shared host)
Apache or nginx version Apache 2.4.?
PHP version 7.2.11

issue:
Since I’ve updated from 15.0.0. to 15.0.2 I cannot upload files/create folders from any (client, webdav, brwoser) source to all my accounts in my nextcloud instance.

  • (I cannot be sure if this didn’t start already at the update from 14.0.4 to 15.0.0 because I didn’t upload/sync any files in the time between).
  • I did a manual update as always (all files removed and fresh nextcloud zip uploaded).
  • I got the big.init errors from Nextcloud 15.0.0 update, so I used mysql (as described in this forum) to fix this
  • fixed another error by creating 4-6 indices in the mysql database (share_owner,…)

Error-Message says: “File entry could not be inserted but could also not be selected with getId() in order to perform an update. Please try again” (log see below)

I’ve already tried to unlock all files (cleared the 17 entries in mysql) and used occ files:search (via php as I’m on shared hosting!) - nothing changed.

No ideas anymore… I’m finishing my phd at the moment and do need my cloud for backup, not for extra work. :stuck_out_tongue_closed_eyes:

Thanks in advance!!!

PS: Also TOTP-2FA Auth didn’t work. Activating was possible, but was never asked when logging in to enter a Code. So I disabled it again and deleted the app. (see 2. log below)

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

Steps to replicate it:
Try to upload file or create a folder from client, webdav or browser

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: RuntimeException: File entry could not be inserted but could also not be selected with getId() in order to perform an update. Please try again. at <<closure>>

 0. /www/htdocs/user/domain/nextcloud/lib/private/Files/Cache/Cache.php line 232
    insert("files/documents ... x", {mimetype: "appl ... "})
 1. /www/htdocs/user/domain/nextcloud/lib/private/Files/Cache/Scanner.php line 292
    put("files/documents ... x", {mimetype: "appl ... "})
 2. /www/htdocs/user/domain/nextcloud/lib/private/Files/Cache/Scanner.php line 221
    addToCache("files/documents ... x", {mimetype: "appl ... "}, -1)
 3. /www/htdocs/user/domain/nextcloud/lib/private/Files/Cache/Scanner.php line 336
    scanFile("files/documents ... x", 3, 6, false, false)
 4. /www/htdocs/user/domain/nextcloud/lib/private/Files/Cache/Updater.php line 124
    scan("files/documents ... x", false, 3, false)
 5. /www/htdocs/user/domain/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 244
    update("files/documents ... x")
 6. /www/htdocs/user/domain/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156
    put(null)
 7. /www/htdocs/user/domain/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    createFile("bergfex_naturro ... x", null)
 8. /www/htdocs/user/domain/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile("documents/bergf ... x", null, null)
 9. <<closure>>
    httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
10. /www/htdocs/user/domain/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
11. /www/htdocs/user/domain/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PUT", [Sabre\HTTP\Requ ... }])
12. /www/htdocs/user/domain/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
13. /www/htdocs/user/domain/nextcloud/apps/dav/appinfo/v1/webdav.php line 80
    exec()
14. /www/htdocs/user/domain/nextcloud/remote.php line 163
    require_once("/www/htdocs/user ... p")

PUT /remote.php/webdav/documents/bergfex_naturrodelbahn-breitenberg-ostler-forstweg.gpx
from IP by admin at 2019-01-12T02:29:54+00:00

[… before 2FA was disabled:]

[index] Error: Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO `oc_activity` (`app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `user`, `affecteduser`, `timestamp`, `priority`, `type`, `object_type`, `object_id`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["twofactor_totp", "totp_disabled_subject", "[]", "", "[]", "", "", "user", "user", XXXXXX, 30, "security", "", 0]:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at <<closure>>

 0. /www/htdocs/user/domain/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 128
    convertException("An exception oc ... '", Doctrine\DBAL\Dr ... ]})
 1. /www/htdocs/user/domain/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 1015
    driverExceptionDuringQuery(Doctrine\DBAL\Driver\PDOMySql\Driver {}, Doctrine\DBAL\Dr ... ]}, "INSERT INTO `oc ... )", {1: "twofactor_t ... 0})
 2. /www/htdocs/user/domain/nextcloud/lib/private/DB/Connection.php line 216
    executeUpdate("INSERT INTO `oc ... )", ["twofactor_totp ... 0], [2,2,2,2,2,2,2,2,2,2,2,2,2,2])
 3. /www/htdocs/user/domain/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php line 208
    executeUpdate("INSERT INTO `oc ... )", {app: "twofactor ... "}, [])
 4. /www/htdocs/user/domain/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 214
    execute()
 5. /www/htdocs/user/domain/nextcloud/apps/activity/lib/Data.php line 100
    execute()
 6. /www/htdocs/user/domain/nextcloud/apps/activity/lib/Consumer.php line 76
    send(OC\Activity\Event {})
 7. /www/htdocs/user/domain/nextcloud/lib/private/Activity/Manager.php line 196
    receive(OC\Activity\Event {})
 8. /www/htdocs/user/domain/nextcloud/apps/twofactor_totp/lib/Listener/StateChangeActivity.php line 56
    publish(OC\Activity\Event {})
 9. /www/htdocs/user/domain/nextcloud/apps/twofactor_totp/lib/AppInfo/Application.php line 52
    handle("*** sensitive parameter replaced ***")
10. /www/htdocs/user/domain/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 212
    OCA\TwoFactorTOTP\AppInfo\{closure}("*** sensitive parameters replaced ***")
11. /www/htdocs/user/domain/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 44
    doDispatch([Closure {}], "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***")
12. /www/htdocs/user/domain/nextcloud/apps/twofactor_totp/lib/Service/Totp.php line 117
    dispatch("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***")
13. /www/htdocs/user/domain/nextcloud/apps/twofactor_totp/lib/Controller/SettingsController.php line 82
    deleteSecret(OC\User\User {})
14. /www/htdocs/user/domain/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 166
    enable(0, null)
15. /www/htdocs/user/domain/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    executeController(OCA\TwoFactorTOT ... {}, "enable")
16. /www/htdocs/user/domain/nextcloud/lib/private/AppFramework/App.php line 118
    dispatch(OCA\TwoFactorTOT ... {}, "enable")
17. /www/htdocs/user/domain/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    main("OCA\\TwoFactorT ... r", "enable", OC\AppFramework\ ... {}, {_route: "twofac ... "})
18. <<closure>>
    __invoke({_route: "twofac ... "})
19. /www/htdocs/user/domain/nextcloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {_route: "twofac ... "})
20. /www/htdocs/user/domain/nextcloud/lib/base.php line 987
    match("/apps/twofactor_totp/settings/enable")
21. /www/htdocs/user/domain/nextcloud/index.php line 42
    handleRequest()

POST /index.php/apps/twofactor_totp/settings/enable
from IP by user at 2019-01-12T01:21:37+00:00

I don’t know what’s going on on your site but on my installation file upload works just fine. (15.0.2,php-7.2.14)

1 Like

Thanks for the response. Maybe because of the changes to the db.
I just checked: downloads and deletion is working without any problems… just upload is not working (there is even the animation for uploading the file).
Does anybody know where nextcloud caches the uploads? maybe there is a permission error or something like that?
Thanks for any help…

Maybe this helps: I ran into such an issue a while ago and found that after I upgraded to (i think 15.0.0) authetication to the web client was fine but ran into issues with the (ios) app. Then found I had DB issues as the MariaDB did not come up after a server reboot. Had to repair it to get the transactions perfomed af after it started again the app worked fine too.

A little bit late, but here is my solution:

  • Deactivate file_lock (either by config file or occ)
  • Empty the tables file_lock and filecache (mysql)
  • Login and look if everything works
  • activate file_lock again and rebuild filecache.
1 Like