# Bootstrap error: relation "ai\_agent\_mcp\_servers" does not exist -- due to migration id collision

**URL:** https://meta.discourse.org/t/bootstrap-error-relation-ai-agent-mcp-servers-does-not-exist-due-to-migration-id-collision/399572
**Category:** Self-hosting
**Created:** [March 30, 2026, 3:36pm UTC](https://meta.discourse.org/t/bootstrap-error-relation-ai-agent-mcp-servers-does-not-exist-due-to-migration-id-collision/399572 "2026-03-30T15:36:48Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [March 30, 2026, 3:47pm UTC](https://meta.discourse.org/t/bootstrap-error-relation-ai-agent-mcp-servers-does-not-exist-due-to-migration-id-collision/399572/2 "2026-03-30T15:47:22Z")

</div>

So, here comes a bug report that [ask.discourse.com](http://ask.discourse.com) wrote, but first, I want to share this bit that it offered:

> [@](#):
>
> If you want, I can also make it a little more **pfaffman-style blunt and short**.

I decided to let it be itself, and not “blunt and short”. 🤣 (I didn’t roll on the floor, but I did, truly, laugh out loud.

This seems like a credible report and likely better than I’d have written.

### Bug report from ask . . .

Here’s a concise bug report you can post on Meta:

````plaintext
After updating, bootstrap fails during `db:migrate` with:

```text
PG::UndefinedTable: ERROR: relation "ai_agent_mcp_servers" does not exist

````

The failing migration is:

```plaintext
/plugins/discourse-ai/db/migrate/20260319070000_add_selected_tool_names_to_ai_agent_mcp_servers.rb

```

It appears this migration tries to add a column to `ai_agent_mcp_servers` before that table exists.

Relevant part of the log:

```plaintext
== 20260319070000 AddSelectedToolNamesToAiAgentMcpServers: migrating ==========
PG::UndefinedTable: ERROR: relation "ai_agent_mcp_servers" does not exist
...
/var/www/discourse/plugins/discourse-ai/db/migrate/20260319070000_add_selected_tool_names_to_ai_agent_mcp_servers.rb:5

```

This looks like a migration ordering issue in `discourse-ai`, or a missing earlier migration that should create `ai_agent_mcp_servers`.

Environment:

- official Docker install
- bootstrap fails on `bundle exec rake db:migrate`
- plugins shown in logs include `discourse-citationwizard` and `discourse-prometheus`

Full report / logs:  
[Bootstrap error: relation “ai\_agent\_mcp\_servers” does not exist](https://meta.discourse.org/t/bootstrap-error-relation-ai-agent-mcp-servers-does-not-exist/399572)

---

_[View the full topic](https://meta.discourse.org/t/bootstrap-error-relation-ai-agent-mcp-servers-does-not-exist-due-to-migration-id-collision/399572)._
