Skip to content

An index with name "uniq_9aa5663c947c0fbd4bf59a5d6e63e" was already defined on table "oc_polls_options #4694

@doc75

Description

@doc75

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • I agree to follow Nextcloud's Code of Conduct.

What went wrong, what did you observe?

I saw the issue #4673 , but I cannot reopen it to provide the additional information found during my analysis.

I am migrating to NC33 (docker image) and after the upgrade I run this command:

occ maintenance:repair --include-expensive

I got this error:

- Polls - Create all unique indices
     - ERROR: An index with name "uniq_9aa5663c947c0fbd4bf59a5d6e63e" was already defined on table "oc_polls_options".

What did you expect, how polls should behave instead?

No error when running occ maintenance:repair --include-expensive

What steps does it need to replay this bug?

1.occ polls:db:rebuild
2.occ maintenance:repair --include-expensive => same error

Other try after with:
1.occ polls:db:reset-unique-indices
2.'occ maintenance:repair --include-expensive
Everything goes fine and the output is:

 Polls - Create all unique indices
     - Added unique index (auto) for ["poll_id","poll_option_hash","timestamp"] to polls_options
     - Unique index for ["processed","poll_id","user_id","message_id"] already exists as uniq_unprocessed in polls_log
     - Unique index for ["poll_id","user_id"] already exists as uniq_subscription in polls_notif
     - Unique index for ["poll_id","group_id","user_id"] already exists as uniq_shares in polls_share
     - Unique index for ["token"] already exists as uniq_token in polls_share
     - Unique index for ["poll_id","user_id","vote_option_hash"] already exists as uniq_votes in polls_votes
     - Unique index for ["user_id"] already exists as uniq_preferences in polls_preferences
     - Added unique index (auto) for ["poll_id","table","session_id"] to polls_watch
     - Unique index for ["poll_id","group_id"] already exists as uniq_poll_group_relation in polls_groups_polls
     - Polls - Indices created.

But launching again this command right after:

occ maintenance:repair --include-expensive

then the error is back.

Affected polls version

9.1.1

Installation method

Installed/updated using occ

Installation type

Updated from a minor version within same major version (i.e. 8.0.0 to 8.1.2)

Can you rule out that any extension you use is involved in the issue?

  • I have checked all browser extension

Which browser did you use, when experiencing the bug?

  • Firefox
  • Chrome
  • Chromium/Chromium based (i.e. Edge)
  • Safari
  • Other/Don't know

Other browser

No response

Add your browser log here

Not relevant as the error is on the server

Additional client environment information

NC33.0.3
Error also reproduced on NC32.0.9 with Polls 9.0.7

NC version

Nextcloud 33 (Hub 26 Winter)

Other Nextcloud version

Nextcloud 32

PHP engine version

PHP 8.4

Other PHP version

PHP 8.3

Database engine

PostgreSQL

Database Engine version or other Database

16.13

Which user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other/Don't know

Add your nextcloud server log here

{
    "reqId": "vvwzq1tfofipmYoXAhqB",
    "level": 3,
    "time": "2026-05-09T21:42:18+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "no app in context",
    "method": "",
    "url": "--",
    "scriptName": "occ",
    "message": "Exception while executing repair step Polls - Create all unique indices",
    "userAgent": "--",
    "version": "33.0.3.2",
    "occ_command": [
        "occ",
        "maintenance:repair"
    ],
    "exception": {
        "Exception": "Doctrine\\DBAL\\Schema\\Exception\\IndexAlreadyExists",
        "Message": "An index with name \"uniq_9aa5663c947c0fbd4bf59a5d6e63e\" was already defined on table \"oc_polls_options\".",
        "Code": 60,
        "Trace": [
            {
                "file": "/var/www/html/3rdparty/doctrine/dbal/src/Schema/SchemaException.php",
                "line": 99,
                "function": "new",
                "class": "Doctrine\\DBAL\\Schema\\Exception\\IndexAlreadyExists",
                "type": "::",
                "args": [
                    "uniq_9aa5663c947c0fbd4bf59a5d6e63e",
                    "oc_polls_options"
                ]
            },
            {
                "file": "/var/www/html/3rdparty/doctrine/dbal/src/Schema/Table.php",
                "line": 513,
                "function": "indexAlreadyExists",
                "class": "Doctrine\\DBAL\\Schema\\SchemaException",
                "type": "::",
                "args": [
                    "uniq_9aa5663c947c0fbd4bf59a5d6e63e",
                    "oc_polls_options"
                ]
            },
            {
                "file": "/var/www/html/3rdparty/doctrine/dbal/src/Schema/Table.php",
                "line": 233,
                "function": "_addIndex",
                "class": "Doctrine\\DBAL\\Schema\\Table",
                "type": "->",
                "args": [
                    {
                        "__class__": "Doctrine\\DBAL\\Schema\\Index"
                    }
                ]
            },
            {
                "file": "/var/www/html/custom_apps/polls/lib/Db/V10/IndexManager.php",
                "line": 387,
                "function": "addUniqueIndex",
                "class": "Doctrine\\DBAL\\Schema\\Table",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***",
                    "UNIQ_9AA5663C947C0FBD4BF59A5D6E63E"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/polls/lib/Db/V10/IndexManager.php",
                "line": 425,
                "function": "createIndex",
                "class": "OCA\\Polls\\Db\\V10\\IndexManager",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php",
                "line": 32,
                "function": "createUniqueIndices",
                "class": "OCA\\Polls\\Db\\V10\\IndexManager",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Repair.php",
                "line": 107,
                "function": "run",
                "class": "OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\Repair"
                    }
                ]
            },
            {
                "file": "/var/www/html/core/Command/Maintenance/Repair.php",
                "line": 99,
                "function": "run",
                "class": "OC\\Repair",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/3rdparty/symfony/console/Command/Command.php",
                "line": 326,
                "function": "execute",
                "class": "OC\\Core\\Command\\Maintenance\\Repair",
                "type": "->",
                "args": [
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                    }
                ]
            },
            {
                "file": "/var/www/html/3rdparty/symfony/console/Application.php",
                "line": 1083,
                "function": "run",
                "class": "Symfony\\Component\\Console\\Command\\Command",
                "type": "->",
                "args": [
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                    }
                ]
            },
            {
                "file": "/var/www/html/3rdparty/symfony/console/Application.php",
                "line": 324,
                "function": "doRunCommand",
                "class": "Symfony\\Component\\Console\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\Core\\Command\\Maintenance\\Repair"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                    }
                ]
            },
            {
                "file": "/var/www/html/3rdparty/symfony/console/Application.php",
                "line": 175,
                "function": "doRun",
                "class": "Symfony\\Component\\Console\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                    }
                ]
            },
            {
                "file": "/var/www/html/lib/private/Console/Application.php",
                "line": 187,
                "function": "run",
                "class": "Symfony\\Component\\Console\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    },
                    {
                        "__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                    }
                ]
            },
            {
                "file": "/var/www/html/console.php",
                "line": 92,
                "function": "run",
                "class": "OC\\Console\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
                    }
                ]
            },
            {
                "file": "/var/www/html/occ",
                "line": 33,
                "args": [
                    "/var/www/html/console.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/var/www/html/3rdparty/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php",
        "Line": 15,
        "message": "Exception while executing repair step Polls - Create all unique indices",
        "exception": "{\"class\":\"Doctrine\\DBAL\\Schema\\Exception\\IndexAlreadyExists\",\"message\":\"An index with name \\\"uniq_9aa5663c947c0fbd4bf59a5d6e63e\\\" was already defined on table \\\"oc_polls_options\\\".\",\"code\":60,\"file\":\"/var/www/html/3rdparty/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php:15\",\"trace\":\"#0 /var/www/html/3rdparty/doctrine/dbal/src/Schema/SchemaException.php(99): Doctrine\\DBAL\\Schema\\Exception\\IndexAlreadyExists::new('uniq_9aa5663c94...', 'oc_polls_option...')\\n#1 /var/www/html/3rdparty/doctrine/dbal/src/Schema/Table.php(513): Doctrine\\DBAL\\Schema\\SchemaException::indexAlreadyExists('uniq_9aa5663c94...', 'oc_polls_option...')\\n#2 /var/www/html/3rdparty/doctrine/dbal/src/Schema/Table.php(233): Doctrine\\DBAL\\Schema\\Table->_addIndex(Object(Doctrine\\DBAL\\Schema\\Index))\\n#3 /var/www/html/custom_apps/polls/lib/Db/V10/IndexManager.php(387): Doctrine\\DBAL\\Schema\\Table->addUniqueIndex(Array, 'UNIQ_9AA5663C94...')\\n#4 /var/www/html/custom_apps/polls/lib/Db/V10/IndexManager.php(425): OCA\\Polls\\Db\\V10\\IndexManager->createIndex('polls_options', '', Array, true)\\n#5 /var/www/html/custom_apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php(32): OCA\\Polls\\Db\\V10\\IndexManager->createUniqueIndices()\\n#6 /var/www/html/lib/private/Repair.php(107): OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices->run(Object(OC\\Repair))\\n#7 /var/www/html/core/Command/Maintenance/Repair.php(99): OC\\Repair->run()\\n#8 /var/www/html/3rdparty/symfony/console/Command/Command.php(326): OC\\Core\\Command\\Maintenance\\Repair->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\\n#9 /var/www/html/3rdparty/symfony/console/Application.php(1083): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\\n#10 /var/www/html/3rdparty/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(OC\\Core\\Command\\Maintenance\\Repair), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\\n#11 /var/www/html/3rdparty/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\\n#12 /var/www/html/lib/private/Console/Application.php(187): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\\n#13 /var/www/html/console.php(92): OC\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput))\\n#14 /var/www/html/occ(33): require_once('/var/www/html/c...')\\n#15 {main}\"}",
        "CustomMessage": "Exception while executing repair step Polls - Create all unique indices"
    },
    "id": "69ffb2a181e47"
}

Additional environment informations

No response

Configuration report

{
    "system": {
        "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
            }
        ],
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.virlet.fr",
            "web15"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "33.0.3.2",
        "overwrite.cli.url": "https:\/\/cloud.virlet.fr",
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": 2,
        "updater.release.channel": "stable",
        "data-fingerprint": "99533fd60d6571d75ad27f4e1b366243",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "has_rebuilt_cache": true,
        "theme": "",
        "default_phone_region": "FR",
        "defaultapp": "files",
        "app_install_overwrite": [
            "twofactor_totp",
            "files_mindmap"
        ],
        "maintenance_window_start": 100,
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-amd64-musl",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-amd64"
    }
}

List of activated Apps

Enabled:
  - activity: 6.0.0
  - admin_audit: 1.23.0
  - app_api: 33.0.0
  - bookmarks: 16.1.4
  - bruteforcesettings: 6.0.0
  - calendar: 6.2.4
  - circles: 33.0.0
  - cloud_federation_api: 1.17.0
  - comments: 1.23.0
  - contacts: 8.4.5
  - contactsinteraction: 1.14.1
  - cospend: 4.0.0
  - dashboard: 7.13.0
  - dav: 1.36.0
  - deck: 1.17.1
  - drawio: 4.2.3
  - federatedfilesharing: 1.23.0
  - federation: 1.23.0
  - files: 2.5.0
  - files_downloadlimit: 5.1.0
  - files_external: 1.25.1
  - files_pdfviewer: 6.0.0
  - files_reminders: 1.6.0
  - files_sharing: 1.25.2
  - files_trashbin: 1.23.0
  - files_versions: 1.26.0
  - firstrunwizard: 6.0.0
  - gpxpod: 8.2.1
  - impersonate: 4.0.0
  - keeweb: 0.6.23
  - logreader: 6.0.0
  - lookup_server_connector: 1.21.0
  - mail: 5.7.14
  - memories: 8.0.1
  - nextcloud_announcements: 5.0.0
  - notes: 5.0.0
  - notifications: 6.0.0
  - notify_push: 1.3.2
  - oauth2: 1.21.0
  - password_policy: 5.0.0
  - photos: 6.0.0
  - polls: 9.1.1
  - privacy: 5.0.0
  - profile: 1.2.0
  - provisioning_api: 1.23.0
  - quota_warning: 1.23.0
  - recommendations: 6.0.0
  - related_resources: 4.0.0
  - richdocuments: 10.1.3
  - serverinfo: 5.0.0
  - settings: 1.16.0
  - sharebymail: 1.23.0
  - spreed: 23.0.4
  - support: 5.0.0
  - survey_client: 5.0.0
  - systemtags: 1.23.0
  - text: 7.0.1
  - theming: 2.8.0
  - twofactor_backupcodes: 1.22.0
  - twofactor_totp: 15.0.0
  - updatenotification: 1.23.0
  - user_status: 1.13.0
  - viewer: 6.0.0
  - weather_status: 1.13.0
  - webhook_listeners: 1.5.0
  - workflowengine: 2.15.0
Disabled:
  - encryption: 2.21.0 (installed 2.19.0)
  - maps: 1.6.0 (installed 1.6.0)
  - suspicious_login: 11.0.0
  - testing: 1.23.0
  - twofactor_nextcloud_notification: 7.0.0
  - user_ldap: 1.24.0

Nextcloud Signing status

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
	- INVALID_HASH
		- core/js/mimetypelist.js

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [core/js/mimetypelist.js] => Array
                        (
                            [expected] => cb945c6402e12d9e7d42d0359acf95a6e9a9b0c1f3bd8528f598a7fb1694e5ae34c80cf44ef6c8901eac1bfdd152de3315fc7eac007efee0f33f09ed3e518b6a
                            [current] => 6b290ba45e633706e1fe761ca21422053c113f17b2bb35f2351f2cf1c3b893aa543af6c594077ca213c755cfa0d002e22109bb1797bbadd8fb410ca839143e0e
                        )

                )

        )

)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions