Skip to content

[Bug]: Exception: Database error when running migration for app bookmarks #58408

@scubamuc

Description

@scubamuc

⚠️ This issue respects the following points: ⚠️

Bug description

Hey Team,

we've released Nextcloud snap 32.06snap1 nextcloud-snap/nextcloud-snap#3382 and are getting issues concerning the update of the bookmarks app nextcloud-snap/nextcloud-snap#3384

we've been able to workaround by disabling the bookmarks app, but would appreciate suggestions to resolve this exception:

Exception: Database error when running migration 016002000Date20260201124723 for app bookmarks
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'delirium-a472f04cd78b3b37212d86b672d146b4' for key 'oc_bookmarks.bookmarks_uniq_url'

Steps to reproduce

  1. install Nextcloud snap
  2. install bookmarks app
  3. auto update Nextcloud snap

Expected behavior

Bookmarks migration success

Nextcloud Server version

32

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 32.0.5 to 32.0.6)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "apps_paths": [
            {
                "path": "\/snap\/nextcloud\/current\/htdocs\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/snap\/nextcloud\/current\/nextcloud\/extra-apps",
                "url": "\/extra-apps",
                "writable": true
            }
        ],
        "supportedDatabases": [
            "mysql"
        ],
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "192.168.0.1"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "32.0.5.0",
        "overwrite.cli.url": "http:\/\/localhost",
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": 2,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto, 60",
        "theme": "",
        "maintenance_window_start": 1
    },
    "apps": {
        "activity": {
            "enabled": "yes",
            "installed_version": "5.0.0",
            "types": "filesystem"
        },
        "app_api": {
            "enabled": "yes",
            "installed_version": "32.0.0",
            "types": ""
        },
        "backgroundjob": {
            "lastjob": "49553"
        },
        "bookmarks": {
            "enabled": "yes",
            "installed_version": "16.0.1",
            "types": ""
        },
        "bruteforcesettings": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "circles": {
            "enabled": "yes",
            "installed_version": "32.0.0",
            "loopback_tmp_scheme": "http",
            "maintenance_run": "0",
            "maintenance_update": "{\"maximum\":3,\"3\":1771405859,\"2\":1771407662,\"1\":1771407662,\"4\":1655085726,\"5\":1654917113}",
            "migration_22": "1",
            "migration_22_1": "1",
            "migration_run": "0",
            "types": "filesystem,dav"
        },
        "cloud_federation_api": {
            "enabled": "yes",
            "installed_version": "1.16.0",
            "types": "filesystem"
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "logging"
        },
        "contactsinteraction": {
            "enabled": "yes",
            "installed_version": "1.13.1",
            "types": "dav"
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "default_encryption_module": "OC_DEFAULT_MODULE",
            "enterpriseLogoChecked": "yes",
            "files_metadata_installed": "1",
            "installedat": "1552135885.0763",
            "lastcron": 1771407662,
            "lastupdatedat": "0",
            "metadataGenerationDone": true,
            "moveavatarsdone": "yes",
            "previewsCleanedUp": "1",
            "public_files": "files_sharing\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "scss.variables": "d41d8cd98f00b204e9800998ecf8427e",
            "theming.variables": "d41d8cd98f00b204e9800998ecf8427e",
            "vendor": "nextcloud",
            "files_metadata": {
                "photos-original_date_time": {
                    "value": null,
                    "type": "int",
                    "etag": "",
                    "indexed": true,
                    "editPermission": 0
                },
                "photos-size": {
                    "value": null,
                    "type": "array",
                    "etag": "",
                    "indexed": false,
                    "editPermission": 0
                },
                "photos-exif": {
                    "value": null,
                    "type": "array",
                    "etag": "",
                    "indexed": false,
                    "editPermission": 0
                },
                "photos-ifd0": {
                    "value": null,
                    "type": "array",
                    "etag": "",
                    "indexed": false,
                    "editPermission": 0
                },
                "photos-gps": {
                    "value": null,
                    "type": "array",
                    "etag": "",
                    "indexed": false,
                    "editPermission": 0
                },
                "photos-place": {
                    "value": null,
                    "type": "string",
                    "etag": "",
                    "indexed": true,
                    "editPermission": 0
                },
                "blurhash": {
                    "value": null,
                    "type": "string",
                    "etag": "c98466874981b1371c4e70d3bbf5092b",
                    "indexed": false,
                    "editPermission": 0
                }
            },
            "oc.integritycheck.checker": []
        },
        "dashboard": {
            "enabled": "yes",
            "installed_version": "7.12.0",
            "types": ""
        },
        "dav": {
            "buildCalendarReminderIndex": "yes",
            "buildCalendarSearchIndex": "yes",
            "builtSocialSearchIndex": "yes",
            "chunks_migrated": "1",
            "enabled": "yes",
            "installed_version": "1.34.2",
            "regeneratedBirthdayCalendarsForYearFix": "yes",
            "types": "filesystem"
        },
        "encryption": {
            "enabled": "no",
            "installed_version": "2.3.0",
            "masterKeyId": "master_dbbc061e",
            "publicShareKeyId": "pubShare_dbbc061e",
            "recoveryKeyId": "recoveryKey_dbbc061e",
            "types": "filesystem"
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": ""
        },
        "federation": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "2.4.0",
            "mimetype_version": "32.0.5.0",
            "types": "filesystem"
        },
        "files_downloadlimit": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "files_external": {
            "enabled": "yes",
            "installed_version": "1.24.1",
            "types": "filesystem"
        },
        "files_pdfviewer": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "files_reminders": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": ""
        },
        "files_rightclick": {
            "enabled": "no",
            "installed_version": "1.6.0",
            "types": ""
        },
        "files_sharing": {
            "enabled": "yes",
            "installed_version": "1.24.1",
            "types": "filesystem"
        },
        "files_texteditor": {
            "enabled": "no",
            "installed_version": "2.8.0",
            "types": ""
        },
        "files_trashbin": {
            "background_job_expire_trash_offset": 0,
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "filesystem,dav"
        },
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.25.0",
            "types": "filesystem,dav"
        },
        "firstrunwizard": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "gallery": {
            "enabled": "no",
            "installed_version": "18.4.0",
            "types": ""
        },
        "logreader": {
            "enabled": "yes",
            "installed_version": "5.0.0",
            "types": "logging"
        },
        "lookup_server_connector": {
            "enabled": "yes",
            "installed_version": "1.20.0",
            "types": "authentication"
        },
        "nextcloud_announcements": {
            "enabled": "yes",
            "installed_version": "4.0.0",
            "pub_date": "Thu, 24 Oct 2019 00:00:00 +0200",
            "types": "logging"
        },
        "notifications": {
            "enabled": "yes",
            "installed_version": "5.0.0",
            "setting_batchtime": "3",
            "sound_notification": "no",
            "sound_talk": "no",
            "types": "logging"
        },
        "oauth2": {
            "enabled": "yes",
            "installed_version": "1.20.0",
            "types": "authentication"
        },
        "password_policy": {
            "enabled": "yes",
            "installed_version": "4.0.0",
            "types": "authentication"
        },
        "passwords": {
            "cron\/php\/version\/id": "80125",
            "cron\/php\/version\/string": "8.1.25",
            "enabled": "no",
            "installed_version": "2023.12.32",
            "migration\/customFields": "2020.12.2",
            "passwords\/localdb\/type": "hibp",
            "types": "",
            "web\/php\/version\/id": "80125",
            "web\/php\/version\/string": "8.1.25"
        },
        "photos": {
            "enabled": "yes",
            "installed_version": "5.0.0",
            "lastPlaceMappedUser": "delirium",
            "lastPlaceMappingDone": "true",
            "types": "dav,authentication"
        },
        "privacy": {
            "enabled": "yes",
            "installed_version": "4.0.0-dev.0",
            "types": ""
        },
        "profile": {
            "enabled": "yes",
            "installed_version": "1.1.0",
            "types": ""
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "prevent_group_restriction"
        },
        "recommendations": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "related_resources": {
            "enabled": "yes",
            "installed_version": "3.0.0-dev.0",
            "types": ""
        },
        "serverinfo": {
            "cached_count_appdata_files": 89941,
            "cached_count_filecache": 112253,
            "cached_count_storages": "3",
            "enabled": "yes",
            "installed_version": "4.0.0-dev.0",
            "size_appdata_storage": -1,
            "types": ""
        },
        "settings": {
            "enabled": "yes",
            "installed_version": "1.15.1",
            "types": ""
        },
        "sharebymail": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "filesystem"
        },
        "support": {
            "SwitchUpdaterServerHasRun": "yes",
            "enabled": "yes",
            "installed_version": "4.0.0-dev.0",
            "types": "session"
        },
        "survey_client": {
            "enabled": "yes",
            "installed_version": "4.0.0-dev.0",
            "last_sent": 1769906602,
            "types": "",
            "last_report": "{\"id\":\"ocjmfwepqak1\",\"items\":[[\"server\",\"version\",\"32.0.5.0\"],[\"server\",\"code\",\"other\"],[\"server\",\"enable_avatars\",\"yes\"],[\"server\",\"enable_previews\",\"yes\"],[\"server\",\"memcache.local\",\"\\\\OC\\\\Memcache\\\\Redis\"],[\"server\",\"memcache.distributed\",\"none\"],[\"server\",\"asset-pipeline.enabled\",\"no\"],[\"server\",\"filelocking.enabled\",\"yes\"],[\"server\",\"memcache.locking\",\"\\\\OC\\\\Memcache\\\\Redis\"],[\"server\",\"debug\",\"no\"],[\"server\",\"cron\",\"cron\"],[\"php\",\"version\",\"8.3.29\"],[\"php\",\"memory_limit\",536870912],[\"php\",\"max_execution_time\",0],[\"php\",\"upload_max_filesize\",2097152],[\"database\",\"type\",\"mysql\"],[\"database\",\"version\",\"8.0.45\"],[\"database\",\"size\",138051584],[\"apps\",\"activity\",\"5.0.0-dev.0\"],[\"apps\",\"app_api\",\"32.0.0\"],[\"apps\",\"bookmarks\",\"16.0.1\"],[\"apps\",\"bruteforcesettings\",\"5.0.0-dev.0\"],[\"apps\",\"circles\",\"32.0.0\"],[\"apps\",\"cloud_federation_api\",\"1.16.0\"],[\"apps\",\"comments\",\"1.22.0\"],[\"apps\",\"contactsinteraction\",\"1.13.1\"],[\"apps\",\"dashboard\",\"7.12.0\"],[\"apps\",\"dav\",\"1.34.2\"],[\"apps\",\"encryption\",\"disabled\"],[\"apps\",\"federatedfilesharing\",\"1.22.0\"],[\"apps\",\"federation\",\"1.22.0\"],[\"apps\",\"files\",\"2.4.0\"],[\"apps\",\"files_downloadlimit\",\"5.0.0-dev.0\"],[\"apps\",\"files_external\",\"1.24.1\"],[\"apps\",\"files_pdfviewer\",\"5.0.0-dev.0\"],[\"apps\",\"files_reminders\",\"1.5.0\"],[\"apps\",\"files_rightclick\",\"disabled\"],[\"apps\",\"files_sharing\",\"1.24.1\"],[\"apps\",\"files_texteditor\",\"disabled\"],[\"apps\",\"files_trashbin\",\"1.22.0\"],[\"apps\",\"files_versions\",\"1.25.0\"],[\"apps\",\"firstrunwizard\",\"5.0.0-dev.0\"],[\"apps\",\"gallery\",\"disabled\"],[\"apps\",\"logreader\",\"5.0.0-dev.0\"],[\"apps\",\"lookup_server_connector\",\"1.20.0\"],[\"apps\",\"nextcloud_announcements\",\"4.0.0-dev.0\"],[\"apps\",\"notifications\",\"5.0.0-dev.0\"],[\"apps\",\"oauth2\",\"1.20.0\"],[\"apps\",\"password_policy\",\"4.0.0-dev.0\"],[\"apps\",\"passwords\",\"disabled\"],[\"apps\",\"photos\",\"5.0.0-dev.1\"],[\"apps\",\"privacy\",\"4.0.0-dev.0\"],[\"apps\",\"profile\",\"1.1.0\"],[\"apps\",\"provisioning_api\",\"1.22.0\"],[\"apps\",\"recommendations\",\"5.0.0-dev.0\"],[\"apps\",\"related_resources\",\"3.0.0-dev.0\"],[\"apps\",\"serverinfo\",\"4.0.0-dev.0\"],[\"apps\",\"settings\",\"1.15.1\"],[\"apps\",\"sharebymail\",\"1.22.0\"],[\"apps\",\"support\",\"4.0.0-dev.0\"],[\"apps\",\"survey_client\",\"4.0.0-dev.0\"],[\"apps\",\"systemtags\",\"1.22.0\"],[\"apps\",\"tasks\",\"0.17.1\"],[\"apps\",\"text\",\"6.0.1\"],[\"apps\",\"theming\",\"disabled\"],[\"apps\",\"twofactor_backupcodes\",\"1.21.0\"],[\"apps\",\"user_status\",\"1.12.0\"],[\"apps\",\"viewer\",\"5.0.0-dev.0\"],[\"apps\",\"weather_status\",\"1.12.0\"],[\"apps\",\"webhook_listeners\",\"1.3.0\"],[\"apps\",\"workflowengine\",\"2.14.0\"],[\"stats\",\"num_files\",112255],[\"stats\",\"num_users\",1],[\"stats\",\"num_storages\",3],[\"stats\",\"num_storages_local\",1],[\"stats\",\"num_storages_home\",1],[\"stats\",\"num_storages_other\",1],[\"stats\",\"num_comments\",0],[\"stats\",\"num_comment_markers\",0],[\"stats\",\"num_systemtags\",0],[\"stats\",\"num_systemtags_mappings\",0],[\"files_sharing\",\"num_shares\",0],[\"files_sharing\",\"num_shares_user\",0],[\"files_sharing\",\"num_shares_groups\",0],[\"files_sharing\",\"num_shares_link\",0],[\"files_sharing\",\"num_shares_link_no_password\",0],[\"files_sharing\",\"num_fed_shares_sent\",0],[\"files_sharing\",\"num_fed_shares_received\",0],[\"encryption\",\"enabled\",\"no\"],[\"encryption\",\"default_module\",\"yes\"]]}"
        },
        "systemtags": {
            "enabled": "yes",
            "installed_version": "1.22.0",
            "types": "logging"
        },
        "tasks": {
            "enabled": "yes",
            "installed_version": "0.17.1",
            "types": ""
        },
        "text": {
            "enabled": "yes",
            "installed_version": "6.0.1",
            "types": "dav"
        },
        "theming": {
            "enabled": "no",
            "installed_version": "2.7.0",
            "types": "logging"
        },
        "twofactor_backupcodes": {
            "enabled": "yes",
            "installed_version": "1.21.0",
            "types": ""
        },
        "user_status": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": ""
        },
        "viewer": {
            "enabled": "yes",
            "installed_version": "5.0.0-dev.0",
            "types": ""
        },
        "weather_status": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": ""
        },
        "webhook_listeners": {
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": "filesystem"
        },
        "workflowengine": {
            "enabled": "yes",
            "installed_version": "2.14.0",
            "types": "filesystem"
        }
    }
}

List of activated Apps

Enabled:
  - activity: 5.0.0
  - admin_audit: 1.22.0
  - bruteforcesettings: 5.0.0
  - calendar: 6.2.0
  - cloud_federation_api: 1.16.0
  - comments: 1.22.0
  - contacts: 8.3.3
  - dashboard: 7.12.0
  - dav: 1.34.2
  - external: 7.0.0
  - federatedfilesharing: 1.22.0
  - federation: 1.22.0
  - files: 2.4.0
  - files_external: 1.24.1
  - files_linkeditor: 1.1.23
  - files_reminders: 1.5.0
  - files_sharing: 1.24.1
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - groupfolders: 20.1.11
  - guests: 4.6.0
  - impersonate: 3.0.1
  - integration_mastodon: 4.0.0
  - keeweb: 0.6.22
  - logcleaner: 1.3.1
  - logreader: 5.0.0
  - lookup_server_connector: 1.20.0
  - mail: 5.7.0
  - notes: 4.13.0
  - notifications: 5.0.0
  - notify_push: 1.3.0
  - oauth2: 1.20.0
  - password_policy: 4.0.0
  - photos: 5.0.0
  - privacy: 4.0.0
  - profile: 1.1.0
  - provisioning_api: 1.22.0
  - related_resources: 3.0.0
  - richdocuments: 9.0.2
  - serverinfo: 4.0.0
  - settings: 1.15.1
  - sharebymail: 1.22.0
  - spreed: 22.0.9
  - suspicious_login: 10.0.0
  - systemtags: 1.22.0
  - text: 6.0.1
  - theming: 2.7.0
  - twofactor_backupcodes: 1.21.0
  - user_status: 1.12.0
  - viewer: 5.0.0
  - weather_status: 1.12.0
  - workflowengine: 2.14.0
Disabled:
  - app_api: 32.0.0 (installed 5.0.2)
  - bookmarks: 16.1.0 (installed 16.0.1)
  - circles: 32.0.0 (installed 31.0.0)
  - contactsinteraction: 1.13.1 (installed 1.13.1)
  - encryption: 2.20.0
  - files_downloadlimit: 5.0.0-dev.0 (installed 5.0.0-dev.0)
  - files_pdfviewer: 5.0.0 (installed 2.10.0)
  - files_zip: 2.3.0 (installed 2.2.0)
  - firstrunwizard: 5.0.0 (installed 2.9.0)
  - nextcloud_announcements: 4.0.0 (installed 1.18.0)
  - recommendations: 5.0.0 (installed 0.4.0)
  - support: 4.0.0 (installed 1.8.0)
  - survey_client: 4.0.0 (installed 1.13.0)
  - twofactor_nextcloud_notification: 6.0.0 (installed 3.9.0)
  - twofactor_totp: 14.0.0 (installed 10.0.0-beta.2)
  - user_ldap: 1.23.0
  - webhook_listeners: 1.3.0 (installed 1.3.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Feb 18 14:00:25 hostname nextcloud.apache[67473]: Updated database
Feb 18 14:00:25 hostname nextcloud.apache[67473]: Updating <bookmarks> ...
Feb 18 14:00:25 hostname nextcloud.apache[67473]: Exception: Database error when running migration 016002000Date20260201124723 for app bookmarks
Feb 18 14:00:25 hostname nextcloud.apache[67473]: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'delirium-a472f04cd78b3b37212d86b672d146b4' for key 'oc_bookmarks.bookmarks_uniq_url'
Feb 18 14:00:25 hostname nextcloud.apache[67473]: Update failed
Feb 18 14:00:25 hostname nextcloud.apache[67473]: Maintenance mode is kept active
Feb 18 14:00:25 hostname nextcloud.apache[67473]: Resetting log level
Feb 18 14:00:25 hostname nextcloud.apache[66790]: Unable to upgrade Nextcloud. Will try again.
Feb 18 14:00:25 hostname nextcloud.apache[66790]: Disabling maintenance mode...
Feb 18 14:00:26 hostname nextcloud.apache[66790]: done
Feb 18 14:00:39 hostname nextcloud.apache[66755]: Failed to setup nextcloud

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions