# Problem with restore: function "mirror\_topic\_timers\_topic\_id" already exists with same argument types

**URL:** https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176
**Category:** Bug
**Created:** [September 18, 2025, 7:03pm UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176 "2025-09-18T19:03:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 18, 2025, 7:03pm UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/1 "2025-09-18T19:03:31Z")

</div>

I’m trying to restore a production database from `04dbc622ab1e0197d16703ba47cf005ec93697ee` to a development site `f608e0cd7e7d4785b3ecb401999cfb837cfbe783`

I’m getting these errors:

```plaintext
Failed to migrate database. [90/9045]
Ignoring db/schema_cache.yml because it has expired. The current schema version is 20250724012518, but the one in the schema cache file is 20250916082012.
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

PG::DuplicateFunction: ERROR: function "mirror_topic_timers_topic_id" already exists with same argument types
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:107:in `async_exec'
/home/pfaffman/src/discourse-repos/discourse/db/migrate/20250902014817_add_timerable_id_to_topic_timer.rb:15:in `up'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:242:in `block in <main>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateFunction: ERROR: function "mirror_topic_timers_topic_id" already exists with same argument types (ActiveRecord::S
tatementInvalid)
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:107:in `async_exec'
/home/pfaffman/src/discourse-repos/discourse/db/migrate/20250902014817_add_timerable_id_to_topic_timer.rb:15:in `up'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:242:in `block in <main>'

```

I think it might have to do with this:

[https://github.com/discourse/discourse/pull/34667](https://github.com/discourse/discourse/pull/34667)

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [September 18, 2025, 10:15pm UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/2 "2025-09-18T22:15:58Z")

</div>

Have the same problem (1e42f55be0 to 452e5064c9).

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [September 18, 2025, 11:32pm UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/3 "2025-09-18T23:32:24Z")

</div>

I’ll have a look at this today.

---

<div class="post-metadata">

### Author: ![kulimeya](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kulimeya/32/516545_2.png) [@kulimeya](https://meta.discourse.org/u/kulimeya)
#### Post date: [September 19, 2025, 12:17am UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/5 "2025-09-19T00:17:05Z")

</div>

Crazy, I just finished preparing everything in my dev version, my first Discourse setup, was just gonna importing it in my freshly installed live version and had exactly this error. And the only result on google is this 5h old post. Hope it will be fixed so I can launch.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 19, 2025, 12:56am UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/6 "2025-09-19T00:56:12Z")

</div>

You could contrive to launch with the commit before the one listed here.

Your need to delete the existing database, rebuild with the commit before and could likely do the restore.

And 5 hours is a pretty good SEO

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [September 19, 2025, 1:51am UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/7 "2025-09-19T01:51:24Z")

</div>

I’ve opened a PR with a fix and am getting it reviewed ASAP.

[https://github.com/discourse/discourse/pull/34866](https://github.com/discourse/discourse/pull/34866)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 20, 2025, 1:26am UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/9 "2025-09-20T01:26:14Z")

</div>

And it did get merged soon after his post!

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [September 27, 2025, 1:26am UTC](https://meta.discourse.org/t/problem-with-restore-function-mirror-topic-timers-topic-id-already-exists-with-same-argument-types/383176/10 "2025-09-27T01:26:58Z")

</div>

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