# AI modules suddenly stopped working

**URL:** https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232
**Category:** Bug
**Tags:** ai
**Created:** [February 13, 2024, 5:23pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232 "2024-02-13T17:23:41Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [February 13, 2024, 5:23pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/1 "2024-02-13T17:23:41Z")

</div>

I installed the Discourse AI plugin, setup Gemini and enabled a few modules, Summarization, Sentiment, Related Topics, AI Search and Toxicity.

At first it worked great, the Summarization button showed up and generated the content.

As soon as I enabled the Sentiment and Toxicity options, the Summarization stopped working, as in the button for Summarization disappeared from all topics. The sentiment tab on the dashboard shows no data to display.

When I look at the discourse logs, I see these errors:

```plaintext
Message

Job exception: ERROR: must be owner of database discourse

Backtrace

rack-mini-profiler-3.3.0/lib/patches/db/pg.rb:110:in `exec' 
rack-mini-profiler-3.3.0/lib/patches/db/pg.rb:110:in `async_exec' 
mini_sql-1.5.0/lib/mini_sql/postgres/connection.rb:202:in `run' 
mini_sql-1.5.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `block in run' 
mini_sql-1.5.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `block in with_lock' 
activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' 
activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' 
activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' 
activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' 
mini_sql-1.5.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `with_lock' 
mini_sql-1.5.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `run' 
mini_sql-1.5.0/lib/mini_sql/postgres/connection.rb:181:in `exec' 
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:154:in `create_index!' 
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:71:in `block in consider_indexing' 
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:49:in `each' 
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:49:in `consider_indexing' 
/var/www/discourse/plugins/discourse-ai/app/jobs/scheduled/embeddings_backfill.rb:38:in `execute' 
/var/www/discourse/app/jobs/base.rb:297:in `block (2 levels) in perform' 
rails_multisite-5.0.0/lib/rails_multisite/connection_management.rb:82:in `with_connection'
/var/www/discourse/app/jobs/base.rb:284:in `block in perform' 
/var/www/discourse/app/jobs/base.rb:280:in `each' 
/var/www/discourse/app/jobs/base.rb:280:in `perform' 
/var/www/discourse/app/jobs/base.rb:351:in `perform' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:122:in `process_queue' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:70:in `worker_loop' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:59:in `block (2 levels) in ensure_worker_threads' 

```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 28, 2024, 2:55pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/2 "2024-02-28T14:55:30Z")

</div>

4 posts were split to a new topic: [Discourse AI can’t set ivfflat.probes on self-hosted installs](https://meta.discourse.org/t/discourse-ai-cant-set-ivfflat-probes-on-self-hosted-installs/297091)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 15, 2024, 5:36pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/3 "2024-02-15T17:36:13Z")

</div>

> [@RBoy](#):
>
> `Job exception: ERROR: must be owner of database discourse`

That means your database user can’t run

[https://github.com/discourse/discourse-ai/blob/main/lib/embeddings/vector\_representations/base.rb#L154](https://github.com/discourse/discourse-ai/blob/main/lib/embeddings/vector_representations/base.rb#L154)

on the Discourse database. I suggest checking your permissions.

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [February 16, 2024, 2:00am UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/4 "2024-02-16T02:00:12Z")

</div>

> [@Falco](#):
>
> on the Discourse database. I suggest checking your permissions.

I’m sorry but I’m going to have a draw a blank on this one. I simply followed the instructions on this topic (and the other AI module topics), install the plugin, rebuild discourse and configure it from the admin page.

I didn’t see any step regarding configuring user permissions. Did I miss a step or could this be some exception scenario not handled in the install/build script?

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [February 16, 2024, 9:25pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/5 "2024-02-16T21:25:24Z")

</div>

> [@Falco](#):
>
> That means your database user can’t run on the Discourse database. I suggest checking your permissions.

- How do I do this?
- Shouldn’t this be automatically be set when I install the plugin and rebuild?

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [February 20, 2024, 10:05pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/6 "2024-02-20T22:05:18Z")

</div>

@Falco any thoughts on this?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 28, 2024, 2:58pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/7 "2024-02-28T14:58:08Z")

</div>

Looks like the database user on self-hosted installs lack the permissions to set this. A better way to set this is being tracked upstream, let’s wait for a fix there for a bit before trying to handle it

[https://github.com/pgvector/pgvector/issues/235#issue-1860464316](https://github.com/pgvector/pgvector/issues/235#issue-1860464316)

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [February 28, 2024, 3:29pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/8 "2024-02-28T15:29:23Z")

</div>

Thanks for the update Falco. Could you please let me know what features or the impact of this and/or if it’s related to the log errors or some AI functionality that wont’ work; that I way I know what to expect or what won’t be working and can I need to temporarily disable those features to avoid other issues which may arise from this error.

EDIT: It looks like that number of probes being calculated based on the number of items in the database. Wondering if this could be set during a rebuild (so while the database may grow over time, each time discourse if upgraded, will optimize it until there’s a run time fix). Temporarily, at runtime check if there are SUPERUSER permissions before trying to alter it.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 14, 2024, 8:20pm UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/9 "2024-03-14T20:20:10Z")

</div>

This was fixed as part of the new AI quick search feature

[https://github.com/discourse/discourse-ai/pull/501/commits/ecb16e79e392e6f96505a995b261cc64a1e5da0f](https://github.com/discourse/discourse-ai/pull/501/commits/ecb16e79e392e6f96505a995b261cc64a1e5da0f)

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [March 15, 2024, 12:33am UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/10 "2024-03-15T00:33:56Z")

</div>

Fantastic. Upgrading now. Is there anything I need to do to kick start the previous process?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 16, 2024, 11:00am UTC](https://meta.discourse.org/t/ai-modules-suddenly-stopped-working/295232/11 "2024-03-16T11:00:11Z")

</div>

This topic was automatically closed after 38 hours. New replies are no longer allowed.
