# Error with talk in new installation

**URL:** <https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432>\
**Category:** 💬 Talk (spreed)\
**Created:** [July 18, 2023, 5:31pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432 "2023-07-18T17:31:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nanak\_Singh](https://help.nextcloud.com/user_avatar/help.nextcloud.com/nanak_singh/32/51072_2.png) [@Nanak\_Singh](https://help.nextcloud.com/u/Nanak_Singh)\
**Post date:** [July 18, 2023, 5:31pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/1 "2023-07-18T17:31:36Z")

</div>

![Screenshot 2023-07-18 230050](https://help.nextcloud.com/uploads/default/original/3X/f/2/f2b2c5757254027969dbf0a9477a2a2e180dcdcf.png)

Nextcloud version _(eg, 24.0.1)_: 27  
Talk Server version _(eg, 14.0.2)_: `replace me`  
Custom Signaling server configured: `yes/no and version`  
Custom TURN server configured: `yes/no`  
Custom STUN server configured: `yes/no`

In case the web version of Nextcloud Talk is involved:  
Operating system _(eg, Windows/Ubuntu/…)_: `replace me`  
Browser name and version _(eg, Chrome v101)_: `replace me`

In case mobile Nextcloud Talk apps are involved:  
Talk iOS version _(eg, 14.0.2)_: `replace me`  
Talk Android version _(eg, 14.0.2)_: `replace me`

The issue you are facing:

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

Steps to replicate it:

1. Install a new Nextcloud AIO
2. use ubuntu 22.04

The output of your Nextcloud log in **Admin \> Logging** or errors in nextcloud.log in /var/www/:

```auto
[settings] Error: Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1814
    Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(["Doctrine\\DBAL ... "], ["Doctrine\\DBAL\\Query"])
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1749
    Doctrine\DBAL\Connection->handleDriverException(["Doctrine\\DBAL ... "], ["Doctrine\\DBAL\\Query"])
 2. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1055
    Doctrine\DBAL\Connection->convertExceptionDuringQuery(["Doctrine\\DBAL ... "], "CREATE UNIQUE I ... )", [], [])
 3. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 4. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 6. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 9. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
10. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
11. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
13. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
15. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
16. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
17. /var/www/html/index.php line 36
    OC::handleRequest()

Caused by:

Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php line 77
    Doctrine\DBAL\Driver\PDO\Exception::new(["PDOException", ...]])
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1050
    Doctrine\DBAL\Driver\PDO\Connection->query("CREATE UNIQUE I ... )")
 2. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 3. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 4. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 6. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
 9. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
10. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
11. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
13. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
15. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
16. /var/www/html/index.php line 36
    OC::handleRequest()

Caused by:

PDOException: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php line 72
    PDO->query("CREATE UNIQUE I ... )")
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1050
    Doctrine\DBAL\Driver\PDO\Connection->query("CREATE UNIQUE I ... )")
 2. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 3. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 4. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 6. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
 9. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
10. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
11. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
13. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
15. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
16. /var/www/html/index.php line 36
    OC::handleRequest()

POST /settings/apps/enable
from 203.134.211.196 by admin at 2023-07-18T17:21:12+00:00

```

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

```auto
PASTE HERE

```

Your browser log if relevant (javascript console log, network log, etc.):

```auto
PASTE HERE

```

---

<div class="post-metadata">

**Author:** ![devloic](https://help.nextcloud.com/user_avatar/help.nextcloud.com/devloic/32/53106_2.png) [@devloic](https://help.nextcloud.com/u/devloic)\
**Post date:** [July 19, 2023, 7:36pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/2 "2023-07-19T19:36:13Z")

</div>

same error message “An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation “ts\_session” already exists” with nextcloud aio docker version. nextcloud 27

UPDATE:  
works fine with nextcloud 26  
works fine if you upgrade to nextcloud 27 manually following

> **[How to update to Nextcloud 27 now? · nextcloud/all-in-one · Discussion #2692](https://github.com/nextcloud/all-in-one/discussions/2692)**
>
> If you don't want to wait for AIO getting updated to NC27 for everyone in the near future, you can upgrade to Nextcloud 27 already now by following these steps: First, open the aio interface and cr...

(I had to follow the procedure twice as mentioned in the post )  
Checking [https://yourhost/settings/admin/overview](https://yourhost/settings/admin/overview) tells to run  
php occ db:add-missing-indices  
running it makes the error appear again  
I had to delete the ts\_session index manually in the oc\_talk\_sessions table  
then “php occ db:add-missing-indices” completes without errors  
I then recreated the index again manually changing the name to ts\_session2 with :

CREATE UNIQUE INDEX “ts\_session2” ON “public”.“oc\_talk\_sessions” USING btree (  
“session\_id” COLLATE “pg\_catalog”.“default” “pg\_catalog”.“text\_ops” ASC NULLS LAST  
);

---

<div class="post-metadata">

**Author:** ![SysKeeper](https://help.nextcloud.com/letter_avatar/syskeeper/32/5_5575768a8748004e209b776fc1b2916d.png) [@SysKeeper](https://help.nextcloud.com/u/SysKeeper)\
**Post date:** [July 19, 2023, 10:15pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/3 "2023-07-19T22:15:14Z")

</div>

That’s really interesting and I am wondering if another app tries to create a index with the same name. Would any of you be able to provide a list of indices in the database? See for example [PostgreSQL List Indexes](https://www.postgresqltutorial.com/postgresql-indexes/postgresql-list-indexes/)

---

<div class="post-metadata">

**Author:** ![nickvergessen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/nickvergessen/32/66965_2.png) [@nickvergessen](https://help.nextcloud.com/u/nickvergessen)\
**Post date:** [July 19, 2023, 10:20pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/4 "2023-07-19T22:20:06Z")

</div>

Yes, Text app since the upcoming release:

> <https://github.com/nextcloud/text/commit/e936863a5576d75c482b2e532ee50b13e75c413c>
>
> Signed-off-by: Julius Härtl \<jus@bitgrid.net\>

---

<div class="post-metadata">

**Author:** ![SysKeeper](https://help.nextcloud.com/letter_avatar/syskeeper/32/5_5575768a8748004e209b776fc1b2916d.png) [@SysKeeper](https://help.nextcloud.com/u/SysKeeper)\
**Post date:** [July 19, 2023, 10:21pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/5 "2023-07-19T22:21:36Z")

</div>

Right, and that one also uses the new event which is triggered by `add-missing-indices`…

---

<div class="post-metadata">

**Author:** ![nickvergessen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/nickvergessen/32/66965_2.png) [@nickvergessen](https://help.nextcloud.com/u/nickvergessen)\
**Post date:** [July 19, 2023, 10:32pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/6 "2023-07-19T22:32:57Z")

</div>

[fix(postgres): Use a unique index name by nickvergessen · Pull Request #4553 · nextcloud/text · GitHub](https://github.com/nextcloud/text/pull/4553) should help

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 14, 2024, 12:46pm UTC](https://help.nextcloud.com/t/error-with-talk-in-new-installation/166432/7 "2024-12-14T12:46:49Z")

</div>


