# NoMethodError: undefined method \`min\_tags\_from\_required\_group'

**URL:** https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525
**Category:** Self-hosting
**Created:** [September 9, 2022, 2:10am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525 "2022-09-09T02:10:16Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 9, 2022, 2:10am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/1 "2022-09-09T02:10:16Z")

</div>

Hey Discourse team!

I’m trying to run Discourse Docker on Ubuntu on stable (v2.8.8) and I’m running into the following error:

```plaintext
rake aborted!
NoMethodError: undefined method `min_tags_from_required_group' for #<Category:0x00007fc2ffae9f38>
/src/lib/seed_data/categories.rb:114:in `create_category'
/src/lib/seed_data/categories.rb:15:in `block (2 levels) in create'
/src/lib/seed_data/categories.rb:15:in `each'
/src/lib/seed_data/categories.rb:15:in `block in create'
/src/lib/seed_data/categories.rb:14:in `create'
(eval):6:in `block (2 levels) in run_file'
/src/lib/tasks/db.rake:225:in `block (2 levels) in <main>'
/src/lib/distributed_mutex.rb:33:in `block in synchronize'
/src/lib/distributed_mutex.rb:29:in `synchronize'
/src/lib/distributed_mutex.rb:29:in `synchronize'
/src/lib/distributed_mutex.rb:14:in `synchronize'
/src/lib/tasks/db.rake:210:in `block in <main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

```

### Additional Info of what I’ve done so far:

What I’ve done so far to get here:

```plaintext
sudo -s
git clone -b v2.8.8 https://github.com/discourse/discourse.git
chmod -R 2777 ./discourse
cd discourse

```

I ran into some bookmark issues eariler so I had to:

```plaintext
nano db/migrate/20220104053343_add_bookmark_polymorphic_columns.rb

```

and pasted this: [discourse/db/migrate/20220322024216\_add\_bookmark\_polymorphic\_columns.rb at cd817a436574cd00f0bae339ec0c4fe2fcf2bb50 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/cd817a436574cd00f0bae339ec0c4fe2fcf2bb50/db/migrate/20220322024216_add_bookmark_polymorphic_columns.rb)

Then when I run:

```plaintext
d/boot_dev -p --init

```

I get the error about min\_tags\_from\_required\_groups.

Can anyone assist?

---

<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 9, 2022, 6:46am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/2 "2022-09-09T06:46:06Z")

</div>

Is this a development installation or a [standard install](https://meta.discourse.org/t/142537?silent=true)?

If you’re trying to run on production then you’d set the version to stable in your app.yml. You wouldn’t clone discourse as you indicated.

Do you have any plugins?

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 9, 2022, 7:16am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/3 "2022-09-09T07:16:17Z")

</div>

Hey @pfaffman ,

Thanks for responding!

This is a development instance, so I don’t have the app.yml

No plugins installed, I was just hoping to run a development instance on stable on Ubuntu.

---

<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 9, 2022, 7:25am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/4 "2022-09-09T07:25:08Z")

</div>

Ah! I see now. Perhaps I shouldn’t post on the middle of the night.

Was there a database before you switched to stable? maybe you need to

```
  rake db:drop db:create db:migrate

```

You shouldn’t need to cherry pick a migration.

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 11, 2022, 11:10pm UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/5 "2022-09-11T23:10:09Z")

</div>

Hey @pfaffman ,

Hope you had an awesome weekend! Thanks for responding, will test this today and get back to you!

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 12, 2022, 12:51am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/6 "2022-09-12T00:51:09Z")

</div>

Hey @pfaffman ,

After going `sudo -s` then `d/rake db:drop db:create db:migrate`, I got the following error:

```plaintext
PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development
Couldn't drop database 'discourse_development'
rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development

Caused by:
PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development

Tasks: TOP => db:drop:_unsafe
(See full trace by running task with --trace)

```

I went into `d/psql` and got the list:

```plaintext
discourse-> \l
                                          List of databases
           Name | Owner | Encoding | Collate | Ctype | Access privileges    
--------------------------+----------+----------+-------------+-------------+------------------------
 discourse | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
                          | | | | | postgres=CTc/postgres +
                          | | | | | discourse=CTc/postgres
 discourse_development | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
                          | | | | | postgres=CTc/postgres +
                          | | | | | discourse=CTc/postgres
 discourse_test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
                          | | | | | postgres=CTc/postgres +
                          | | | | | discourse=CTc/postgres
 discourse_test_multisite | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
                          | | | | | postgres=CTc/postgres +
                          | | | | | discourse=CTc/postgres
 postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
                          | | | | | postgres=CTc/postgres
 template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
                          | | | | | postgres=CTc/postgres
(7 rows)

```

How do I go about resolving this error?

---

<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 12, 2022, 4:53am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/7 "2022-09-12T04:53:31Z")

</div>

Hmm. Maybe just delete and recreate those databases yourself and just migrate it with the rake task. Or give the discourse user rights to create and destroy (I think that’s easier).

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 12, 2022, 5:36am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/8 "2022-09-12T05:36:08Z")

</div>

Hey @pfaffman ,

I’m not too familiar on the process of giving the discourse user rights to create and destroy unfortunately. In the first option though, are you saying I should just delete all these databases, then run `d/rake db:create db:migrate` ? Is that correct?

---

<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 12, 2022, 10:31am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/9 "2022-09-12T10:31:39Z")

</div>

Google “postgres user roles” or something like that. That’s what I do. It’s something like this

```plaintext
su - postgres
psql
grant all rights to usee 'discoursev;

```

But that’s probably wrong

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 13, 2022, 12:33am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/10 "2022-09-13T00:33:11Z")

</div>

Hey @pfaffman ,

Thanks for your help so far! I just want to take a step back before going further into troubleshooting psql, I’m mainly aiming to just run the Discourse docker development environment (on stable) on Ubuntu, which runs fine and as expected on Mac. Shouldn’t I be able to do this without these table & migration errors? When I attempt to do a clean install I get the bookmark error, and after resolving that I get this NoMethodError, and now InsufficientPrivilege error.

Initially I thought it was because I was on `test-passed` then switching to stable caused the issue, but even in a clean empty Ubuntu instance, the `NoMethodError` still pops up, this is without any prior DBs exisiting, just did Step #1 and Step #2 here:

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009):
>
> Developing using Docker Since Discourse runs in Docker, you should be able to run Discourse directly from your source directory using a Discourse development container. white_check_mark Pros: No need to install any system dependencies, no configuration needed at all for setting up a development environment quickly. x Cons: Will be slightly slower than the native dev environment on Ubuntu, and much slower than a native install on MacOS. See also [Developing Discourse using a Dev Container](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366) …

Are you able to install stable on Ubuntu with no issues?

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 19, 2022, 12:57am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/11 "2022-09-19T00:57:01Z")

</div>

Bumping this thread! Wondering if anyone else is successful in running a developer environment on stable version on Ubuntu.

---

<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, 2022, 5:23am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/12 "2022-09-19T05:23:36Z")

</div>

Try

```
   ./bundle exec rake db:drop db:create db:migrate

```

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [September 20, 2022, 12:58am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/13 "2022-09-20T00:58:13Z")

</div>

Hey @pfaffman ,

Thanks for your response! Unfortunately I keep running into the same issue:

```plaintext
d/bundle exec rake db:drop db:create db:migrate
PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development
Couldn't drop database 'discourse_development'
rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
PG::InsufficientPrivilege: ERROR: must be owner of database discourse_development
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:drop:_unsafe
(See full trace by running task with --trace)

```

I’ve attempted this on an empty instance (restarted from the start, no existing DBs or information) using the [beginner’s guide](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009) and it renders the same result.

This is the error I still get in `d/rails s`

```plaintext
NoMethodError (undefined method `min_tags_from_required_group' for #<Category:0x00007f3cca7ce5a8>)
(eval):36:in `_fast_attributes'
app/models/site.rb:70:in `block in all_categories_cache'
lib/cache.rb:94:in `fetch'
app/models/site.rb:52:in `all_categories_cache'
app/models/site.rb:78:in `categories'
app/serializers/site_serializer.rb:203:in `categories'
(eval):32:in `_fast_attributes'
app/models/site.rb:167:in `json_for'
app/controllers/application_controller.rb:595:in `preload_anonymous_data'
app/controllers/finish_installation_controller.rb:69:in `ensure_no_admins'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/missing_avatars.rb:23:in `call'
lib/middleware/turbo_dev.rb:34:in `call'

```

---

<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, 2022, 10:37am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-min-tags-from-required-group/238525/14 "2022-09-20T10:37:50Z")

</div>

Then you’ll need to drop the database some other way. You can Google stuff about postgres (that’s what I do when I need to do it) or wait for someone who can remember to post here. The other option is to see that the discourse user has rights to drop and create databases.
