# Error during installation over existant database

**URL:** https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988
**Category:** Troubleshooting
**Created:** [April 5, 2025, 4:43pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988 "2025-04-05T16:43:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jmreymond](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jmreymond](https://forum.mattermost.com/u/jmreymond)
#### Post date: [April 5, 2025, 4:43pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/1 "2025-04-05T16:43:38Z")

</div>

**Summary**  
Error during installation over existant database

**Steps to reproduce**  
mattermost-omnibus/jammy 10.6.1-0 amd64

**Observed behavior**  
I am a very happy user of mattermost which was installed since many years with tgz  
Unfortunatly, my server crashes with a RAID issue.  
Il restore the backuped databases including mattermost but the software mattermost was not backuped.  
So, I install the package from my distribution Ubuntu 22.04 (mattermost-omnibus/jammy 10.6.1-0 amd64  
), setup with my config.json but during the setup, I have the following error message

```auto
Apr 05 18:26:06 2D17911 systemd[1]: Starting Mattermost...
Apr 05 18:26:06 2D17911 mattermost[268182]: {"timestamp":"2025-04-05 18:26:06.519 +02:00","level":"info","msg":"Successfully connected to cache backend","caller":"platform/service.go:193","backend":"lru","result":"OK"}
Apr 05 18:26:06 2D17911 mattermost[268182]: {"timestamp":"2025-04-05 18:26:06.519 +02:00","level":"info","msg":"Server is initializing...","caller":"platform/service.go:196","go_version":"go1.22.6"}
Apr 05 18:26:06 2D17911 mattermost[268182]: {"timestamp":"2025-04-05 18:26:06.520 +02:00","level":"info","msg":"Pinging SQL","caller":"sql/sql_utils.go:68","database":"master","dataSource":"postgres://%2A%2A%2A%2A:%2A%2A%2A%2A@127.0.0.1:5432/mattermost?connect_timeout=10&sslmode=disable"}
Apr 05 18:26:06 2D17911 mattermost[268182]: Error: failed to initialize platform: cannot create store: failed to apply database migrations: driver: postgres, message: failed to execute migration, command: executing_query, originalError: pq: type "outgoingoauthconnections_granttype" already exists, query:
Apr 05 18:26:06 2D17911 mattermost[268182]: CREATE TYPE outgoingoauthconnections_granttype AS ENUM ('client_credentials', 'password');
Apr 05 18:26:06 2D17911 mattermost[268182]: CREATE TABLE IF NOT EXISTS outgoingoauthconnections (
Apr 05 18:26:06 2D17911 mattermost[268182]: id varchar(26) PRIMARY KEY,
Apr 05 18:26:06 2D17911 mattermost[268182]: name varchar(64),
Apr 05 18:26:06 2D17911 mattermost[268182]: creatorid VARCHAR(26),
Apr 05 18:26:06 2D17911 mattermost[268182]: createat bigint,
Apr 05 18:26:06 2D17911 mattermost[268182]: updateat bigint,
Apr 05 18:26:06 2D17911 mattermost[268182]: clientid varchar(255),
Apr 05 18:26:06 2D17911 mattermost[268182]: clientsecret varchar(255),
Apr 05 18:26:06 2D17911 mattermost[268182]: credentialsusername varchar(255),
Apr 05 18:26:06 2D17911 mattermost[268182]: credentialspassword varchar(255),
Apr 05 18:26:06 2D17911 mattermost[268182]: oauthtokenurl text,
Apr 05 18:26:06 2D17911 mattermost[268182]: granttype outgoingoauthconnections_granttype DEFAULT 'client_credentials',
Apr 05 18:26:06 2D17911 mattermost[268182]: audiences VARCHAR(1024)
Apr 05 18:26:06 2D17911 mattermost[268182]: );
Apr 05 18:26:06 2D17911 mattermost[268182]: CREATE INDEX IF NOT EXISTS idx_outgoingoauthconnections_name ON outgoingoauthconnections (name);
Apr 05 18:26:06 2D17911 mattermost[268182]: {"timestamp":"2025-04-05 18:26:06.586 +02:00","level":"error","msg":"failed to initialize platform: cannot create store: failed to apply database migrations: driver: postgres, message: failed to execute migration, command: executing_query, originalError: pq: type \"outgoingoauthconnections_granttype\" already exists, query: \n\nCREATE TYPE outgoingoauthconnections_granttype AS ENUM ('client_credentials', 'password');\n\nCREATE TABLE IF NOT EXISTS outgoingoauthconnections (\n id varchar(26) PRIMARY KEY,\n name varchar(64),\n creatorid VARCHAR(26),\n createat bigint,\n updateat bigint,\n clientid varchar(255),\n clientsecret varchar(255),\n credentialsusername varchar(255),\n credentialspassword varchar(255),\n oauthtokenurl text,\n granttype outgoingoauthconnections_granttype DEFAULT 'client_credentials',\n audiences VARCHAR(1024)\n);\n\nCREATE INDEX IF NOT EXISTS idx_outgoingoauthconnections_name ON outgoingoauthconnections (name);\n\n","caller":"commands/server.go:75"}

```

How can I solve the issue ?  
thanks for your tips,

---

<div class="post-metadata">

### Author: ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)
#### Post date: [April 5, 2025, 5:00pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/2 "2025-04-05T17:00:40Z")

</div>

What version of Mattermost did you have running from “many years” ago? You need to restore that version, or the first ESR available after it (see [Version archive - Mattermost documentation](https://docs.mattermost.com/about/version-archive.html)), then upgrade ESR to ESR until you get to 10.5.2, and then go to 10.6.1 if you want leading edge.

---

<div class="post-metadata">

### Author: ![jmreymond](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jmreymond](https://forum.mattermost.com/u/jmreymond)
#### Post date: [April 5, 2025, 6:01pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/3 "2025-04-05T18:01:39Z")

</div>

Thanks for your answer  
Unfortunately, I don’t know the version I was running.  
Is the version stored in the database ?  
Why the process of installation is confused about  
CREATE INDEX IF NOT EXISTS idx\_outgoingoauthconnections\_name ON outgoingoauthconnections (name);  
I don’t understand the error since there is a IF NOT EXISTS argument.  
thanks

---

<div class="post-metadata">

### Author: ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)
#### Post date: [April 5, 2025, 10:10pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/4 "2025-04-05T22:10:39Z")

</div>

I doubt it. It’s possible there’s something that could be extracted from the database that might help. I can ask.

I would make sure I had a good backup of the database. Then try with 4.10.10 and see if it’ll run without errors.

---

<div class="post-metadata">

### Author: ![jmreymond](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jmreymond](https://forum.mattermost.com/u/jmreymond)
#### Post date: [April 5, 2025, 10:22pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/5 "2025-04-05T22:22:52Z")

</div>

It is ok with 9.2.6 and mattermost is running but unfortunately, Desktop application is not OK :  
The mattermost server you are accessing is incompatible with this version of Mattermost Desktop App. To connect to this server, try the following

- Downgrade your Mattermost desktop App to version 5.10 or earlier

I upgrade to 9.3.3 and it is ok for the server  
I upgrade to 9.4.5 and it is not good, message from migration with

```auto
mattermost[354401]: Error: failed to initialize platform: cannot create store: failed to apply database migrations: driver: postgres, message: failed to execute migration, command: executing_query, originalError: pq: type "outgoingoauthconnections_granttype" already exists, query:
Apr 06 00:20:21 2D17911 mattermost[354401]: CREATE TYPE outgoingoauthconnections_granttype AS ENUM ('client_credentials', 'password');
Apr 06 00:20:21 2D17911 mattermost[354401]: CREATE TABLE IF NOT EXISTS outgoingoauthconnections (
Apr 06 00:20:21 2D17911 mattermost[354401]: id varchar(26) PRIMARY KEY,

```

---

<div class="post-metadata">

### Author: ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)
#### Post date: [April 5, 2025, 11:50pm UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/6 "2025-04-05T23:50:45Z")

</div>

You are running a Postgres database, correct? What version?

You need to have an app version that matches with your server: [Desktop releases - Mattermost documentation](https://docs.mattermost.com/about/mattermost-desktop-releases.html)

A browser would always work.

And from 9.2.6 I’d go to 9.5.13 It could easily have improved migration tools over a non-ESR.

---

<div class="post-metadata">

### Author: ![jmreymond](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jmreymond](https://forum.mattermost.com/u/jmreymond)
#### Post date: [April 6, 2025, 3:46am UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/7 "2025-04-06T03:46:29Z")

</div>

postgresql 14 on the server  
mattermost 9.3.3 on the server  
mattermost-desktop 5.11 on my desktop (Ubuntu 24.04) and another users with Mac and Windows clients

---

<div class="post-metadata">

### Author: ![jmreymond](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jmreymond](https://forum.mattermost.com/u/jmreymond)
#### Post date: [April 7, 2025, 7:28am UTC](https://forum.mattermost.com/t/error-during-installation-over-existant-database/22988/8 "2025-04-07T07:28:23Z")

</div>

finally, I have destroyed the empty table outgoingoauthconnections and migrated to 10.5.2  
thanks,
