Data too long for column "file_target"

Yesterday, I upgraded to nextcloud 10.0.1 from 10.0.0 (yes, I know I’m late but I missed the release somehow).

Since then, nextcloud started filling my logfiles with this error message:

 Nov 23 09:53:14 www04 ownCloud[31511]: {no app in context} Exception: {"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing 'UPDATE `oc_share` SET `file_target` = ? WHERE `id` = ?' with params [\"\\\/01 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2).ogg\", \"16\"]:\n\nSQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'file_target' at row 1","Code":0,"Trace":"#0 \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(116): Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1 \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(996): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), 'UPDATE `oc_shar...', Array)\n#2 \/var\/www\/nextcloud\/lib\/private\/DB\/Connection.php(210): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_shar...', Array, Array)\n#3 \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php(208): OC\\DB\\Connection->executeUpdate('UPDATE `oc_shar...', Array, Array)\n#4 \/var\/www\/nextcloud\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php(142): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 \/var\/www\/nextcloud\/lib\/private\/Share20\/DefaultShareProvider.php(406): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 \/var\/www\/nextcloud\/lib\/private\/Share20\/Manager.php(878): OC\\Share20\\DefaultShareProvider->move(Object(OC\\Share20\\Share), '<username>')\n#7 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/SharedMount.php(120): OC\\Share20\\Manager->moveShare(Object(OC\\Share20\\Share), '<username>')\n#8 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/SharedMount.php(102): OCA\\Files_Sharing\\SharedMount->updateFileTarget('\/01 (2) (2) (2)...', Object(OC\\Share20\\Share))\n#9 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/SharedMount.php(73): OCA\\Files_Sharing\\SharedMount->verifyMountPoint(Object(OC\\Share20\\Share), Array)\n#10 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/MountProvider.php(91): OCA\\Files_Sharing\\SharedMount->__construct('\\\\OC\\\\Files\\\\Stora...', Array, Array, Object(OC\\Files\\Storage\\StorageFactory))\n#11 \/var\/www\/nextcloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(77): OCA\\Files_Sharing\\MountProvider->getMountsForUser(Object(OC\\User\\User), Object(OC\\Files\\Storage\\StorageFactory))\n#12 [internal function]: OC\\Files\\Config\\MountProviderCollection->OC\\Files\\Config\\{closure}(Object(OCA\\Files_Sharing\\MountProvider))\n#13 \/var\/www\/nextcloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(78): array_map(Object(Closure), Array)\n#14 \/var\/www\/nextcloud\/lib\/private\/Files\/Filesystem.php(423): OC\\Files\\Config\\MountProviderCollection->getMountsForUser(Object(OC\\User\\User))\n#15 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(94): OC\\Files\\Filesystem::initMountPoints('<username>')\n#16 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(423): OC\\Files\\Storage\\Shared->init()\n#17 \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(486): OC\\Files\\Storage\\Shared->getWrapperStorage()\n#18 \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/sharedstorage.php(115): OC\\Files\\Storage\\Wrapper\\Wrapper->instanceOfStorage('\\\\OC\\\\Files\\\\Stora...')\n#19 \/var\/www\/nextcloud\/lib\/private\/legacy\/util.php(149): OC\\Files\\Storage\\Shared->instanceOfStorage('\\\\OC\\\\Files\\\\Stora...')\n#20 \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/StorageFactory.php(101): OC_Util::{closure}('\/<username>\/files\/Pois...', Object(OC\\Files\\Storage\\Shared), Object(OCA\\Files_Sharing\\SharedMount))\n#21 \/var\/www\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(146): OC\\Files\\Storage\\StorageFactory->wrap(Object(OCA\\Files_Sharing\\SharedMount), Object(OC\\Files\\Storage\\Shared))\n#22 \/var\/www\/nextcloud\/lib\/private\/Files\/Mount\/MountPoint.php(170): OC\\Files\\Mount\\MountPoint->createStorage()\n#23 \/var\/www\/nextcloud\/lib\/private\/Files\/View.php(1357): OC\\Files\\Mount\\MountPoint->getStorage()\n#24 \/var\/www\/nextcloud\/lib\/private\/Files\/Node\/Root.php(181): OC\\Files\\View->getFileInfo('\/<username>')\n#25 \/var\/www\/nextcloud\/lib\/private\/AvatarManager.php(95): OC\\Files\\Node\\Root->get('\/<username>')\n#26 \/var\/www\/nextcloud\/lib\/private\/User\/User.php(381): OC\\AvatarManager->getAvatar('<username>')\n#27 \/var\/www\/nextcloud\/apps\/dav\/lib\/CardDAV\/Converter.php(165): OC\\User\\User->getAvatarImage(-1)\n#28 \/var\/www\/nextcloud\/apps\/dav\/lib\/CardDAV\/Converter.php(76): OCA\\DAV\\CardDAV\\Converter->getAvatarImage(Object(OC\\User\\User))\n#29 \/var\/www\/nextcloud\/apps\/dav\/lib\/CardDAV\/SyncService.php(229): OCA\\DAV\\CardDAV\\Converter->updateCard(Object(Sabre\\VObject\\Component\\VCard), Object(OC\\User\\User))\n#30 \/var\/www\/nextcloud\/apps\/dav\/lib\/HookManager.php(100): OCA\\DAV\\CardDAV\\SyncService->updateUser(Object(OC\\User\\User))\n#31 \/var\/www\/nextcloud\/lib\/private\/legacy\/hook.php(106): OCA\\DAV\\HookManager->changeUser(Array)\n#32 \/var\/www\/nextcloud\/lib\/private\/Server.php(280): OC_Hook::emit('OC_User', 'changeUser', Array)\n#33 [internal function]: OC\\Server->OC\\{closure}(Object(OC\\User\\User), 'quota', '1 GB')\n#34 \/var\/www\/nextcloud\/lib\/private\/Hooks\/EmitterTrait.php(99): call_user_func_array(Object(Closure), Array)\n#35 \/var\/www\/nextcloud\/lib\/private\/Hooks\/PublicEmitter.php(33): OC\\Hooks\\BasicEmitter->emit('\\\\OC\\\\User', 'changeUser', Array)\n#36 \/var\/www\/nextcloud\/lib\/private\/User\/User.php(418): OC\\Hooks\\PublicEmitter->emit('\\\\OC\\\\User', 'changeUser', Array)\n#37 \/var\/www\/nextcloud\/lib\/private\/User\/User.php(365): OC\\User\\User->triggerChange('quota', '1 GB')\n#38 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/User\/User.php(471): OC\\User\\User->setQuota('1 GB')\n#39 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/User\/User.php(161): OCA\\User_LDAP\\User\\User->updateQuota('1073741824')\n#40 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/Access.php(702): OCA\\User_LDAP\\User\\User->processAttributes(Array)\n#41 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/Access.php(674): OCA\\User_LDAP\\Access->batchApplyUserAttributes(Array)\n#42 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/Access.php(647): OCA\\User_LDAP\\Access->fetchListOfUsers('(&(|(uid=<username>)(m...', Array)\n#43 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php(115): OCA\\User_LDAP\\Access->fetchUsersByLoginName('<username>', Array)\n#44 \/var\/www\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php(84): OCA\\User_LDAP\\User_LDAP->getLDAPUserByLoginName('<username>')\n#45 \/var\/www\/nextcloud\/lib\/private\/User\/Manager.php(161): OCA\\User_LDAP\\User_LDAP->loginName2UserName('<username>')\n#46 \/var\/www\/nextcloud\/lib\/private\/User\/Manager.php(141): OC\\User\\Manager->getUserObject('<username>', Object(OCA\\User_LDAP\\User_LDAP))\n#47 \/var\/www\/nextcloud\/lib\/private\/User\/Session.php(197): OC\\User\\Manager->get('<username>')\n#48 \/var\/www\/nextcloud\/lib\/private\/App\/AppManager.php(154): OC\\User\\Session->getUser()\n#49 \/var\/www\/nextcloud\/lib\/private\/legacy\/app.php(322): OC\\App\\AppManager->isEnabledForUser('user_webdavauth')\n#50 \/var\/www\/nextcloud\/lib\/public\/App.php(132): OC_App::isEnabled('user_webdavauth')\n#51 \/var\/www\/nextcloud\/apps\/user_ldap\/appinfo\/app.php(71): OCP\\App::isEnabled('user_webdavauth')\n#52 \/var\/w

Apparently, nextcloud is appending “(2)” to the filename until it is too long for the database column. This happens for several shared files, even though there are not name conflicts.

I already tried removing the “(2)” from the file name in the database, but nextcloud just starts appending them again.

Any ideas?

There is a similar report, there is also a potential fix (not clear if it works):

Join the discussion on github if it is the same issue. If it isn’t or you are not sure, open a new one.

Thanks, it did not happen for new shares until now. For the old shares, I simply solved the problem by removing them.