Upgrade to 28.0 fs_storage_path_hash collides oc_filecache

Nextcloud version (eg, 20.0.5): upgrade from 27.1.5 to 28.0.0
Operating system and version (eg, Ubuntu 20.04): RHEL 9.3
Apache or nginx version (eg, Apache 2.4.25): httpd-2.4.57-5.el9.x86_64
PHP version (eg, 7.4): php-fpm-8.2.13-1.el9.remi.x86_64

The issue you are facing:
After accidental upgrade from 27.1.5 to 28.0.0. (I didn’t want to upgrade yet, but run the command via history)
I get this error message:

occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Exception: Database error when running migration 28000Date20230906104802 for app core
Index name “fs_storage_path_hash” for table “oc_oc_filecache_w2rwmxgg67h9a” collides with the constraint on table “oc_filecache”.
Update failed
Maintenance mode is kept active
Resetting log level

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. upgrade to 28.0.0

The output of your Nextcloud log in Admin > Logging:

{"reqId":"AFI2UfRD71bVQD23QImY","level":3,"time":"2023-12-18T16:35:58+01:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Database error when running migration 28000Date20230906104802 for app core\nIndex name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\".","userAgent":"--","version":"27.1.5.1","exception":{"Exception":"Exception","Message":"Database error when running migration 28000Date20230906104802 for app core\nIndex name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\".","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Updater.php","line":322,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":261,"function":"doCoreUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.0.11","27.1.5.1"]},{"file":"/var/www/nextcloud/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":206,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/DB/MigrationService.php","Line":406,"Previous":{"Exception":"InvalidArgumentException","Message":"Index name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\".","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":517,"function":"ensureUniqueNamesConstraints","class":"OC\\DB\\MigrationService","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":402,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["28000Date20230906104802",false]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":322,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":261,"function":"doCoreUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.0.11","27.1.5.1"]},{"file":"/var/www/nextcloud/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":206,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/DB/MigrationService.php","Line":671},"message":"Database error when running migration 28000Date20230906104802 for app core\nIndex name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\".","exception":{},"CustomMessage":"Database error when running migration 28000Date20230906104802 for app core\nIndex name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\"."}}
{"reqId":"AFI2UfRD71bVQD23QImY","level":3,"time":"2023-12-18T16:35:58+01:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::failure: Exception: Database error when running migration 28000Date20230906104802 for app core\nIndex name \"fs_storage_path_hash\" for table \"oc_oc_filecache_w2rwmxgg67h9a\" collides with the constraint on table \"oc_filecache\".","userAgent":"--","version":"27.1.5.1","data":{"app":"updater"}}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Can't disable managment mode.

The output of your Apache/nginx/system log in /var/log/____:

no output about error. Only a lot of connections requests, that are denied, because of maintanance mode.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

See above.

Hi,

Can I savely remove the - apperently - temporary table oc_oc_filecache_w2rwmxgg67h9a. Or is this not a good idea?

CU
Jens

How did you get that table into your database?

Is it a backup from some old administrations tasks?

You can solve that with:

  1. Create a database dump

  2. Open your sql console and drop the backup table:

    DROP TABLE nextcloud.oc_oc_filecache_w2rwmxgg67h9a;
    
  3. Restart update

I hope that solves your issue!
Much luck,
ernolf

2 Likes

I worked now. Thanks.

I don’t know why this table was added. I did not do so manually.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.