# MaxMindDB not found error

**URL:** https://meta.discourse.org/t/maxminddb-not-found-error/148512
**Category:** Self-hosting
**Tags:** maxmind
**Created:** [April 19, 2020, 9:55am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512 "2020-04-19T09:55:52Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Sceko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sceko/32/164599_2.png) [@Sceko](https://meta.discourse.org/u/Sceko)
#### Post date: [April 19, 2020, 9:55am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/1 "2020-04-19T09:55:52Z")

</div>

I have some errors in logs

red:

```plaintext
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "groups" does not exist LINE 1: SELECT "groups"."id", "groups"."name" FROM "groups" WHERE
```

yellow

```plaintext
Failed to handle exception in exception app middleware : PG::UndefinedTable: ERROR: relation "groups" does not exist LINE 1: 
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-City.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-City.mmdb
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-ASN.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-ASN.mmdb
```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 19, 2020, 4:45pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/2 "2020-04-19T16:45:40Z")

</div>

You may wish to search for the maxmind issue.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 10, 2020, 11:24am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/3 "2020-09-10T11:24:29Z")

</div>

I do not find an authoritative answer on searching for the issue. Can someone who knows link it here?

Are these MaxMindDB warnings to be ignored? Rebuilding doesn’t seem to fix the issue. I have been getting them for months.

---

<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: [January 5, 2021, 8:59pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/4 "2021-01-05T20:59:55Z")

</div>

> [@k4rtik](#):
>
> I do not find an authoritative answer on searching for the issue.

Now you can! [Configure MAXMIND for reverse IP lookups](https://meta.discourse.org/t/configuring-maxmind-for-reverse-ip-lookups/173941)

---

<div class="post-metadata">

### Author: ![dichter](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dichter/32/226408_2.png) [@dichter](https://meta.discourse.org/u/dichter)
#### Post date: [July 3, 2021, 9:46am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/5 "2021-07-03T09:46:56Z")

</div>

We are using Discourse behind a reverse proxy, so all users have the same IP, and we would need the GeoIP lookup - I do not see the option to disable the IP lookup altogether, instead of going through the registration process and obtaining a license for something that we are not needed, only in order to eliminate the errors from the logs…

Do I miss a setting, on how to disable this?

---

<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: [July 3, 2021, 11:50am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/6 "2021-07-03T11:50:27Z")

</div>

> [@dichter](#):
>
> Discourse behind a reverse proxy, so all users have the same IP,

You should fix that. I think topics like [How to set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013) might have the instructions for that.

I think that if you just don’t set the maxmind key you’ll get a warning when you rebuild but it won’t hurt anything.

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [November 6, 2022, 5:05pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/7 "2022-11-06T17:05:51Z")

</div>

Wouldn’t it be reasonable to hide and skip the GeoIP lookup from user admin settings, if no license key was configured? Or instead show an info/placeholder that GeoIP lookup would be possible by setting a license key following [Configure MAXMIND for reverse IP lookups](https://meta.discourse.org/t/configure-maxmind-for-reverse-ip-lookups/173941)?

Looping through error logs to monitor system operation is good practice, and it’s annoying to spend time on investigating errors, just to find out that they are expected because an operation is attempted which is expected to fail by default and which could be skipped easily by checking a single setting 😉.

I can try open a PR on GitHub, if you basically agree. But probably I’m overlooking something and it isn’t that easy or has downsides I’m not seeing.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 7, 2022, 9:13am UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/8 "2022-11-07T09:13:44Z")

</div>

> [@MichaIng](#):
>
> Or instead show an info/placeholder that GeoIP lookup would be possible by setting a license key following [Configure MAXMIND for reverse IP lookups](https://meta.discourse.org/t/configure-maxmind-for-reverse-ip-lookups/173941)?

Sounds good, would be happy with a PR

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [November 11, 2022, 9:22pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/9 "2022-11-11T21:22:15Z")

</div>

PR up, but I need some help to apply tests, in code and how to test on running Discourse instance: [UX: Show if MaxMind key is missing on IP lookup by MichaIng · Pull Request #18993 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/18993)

---

<div class="post-metadata">

### Author: ![ToddZ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toddz/32/328350_2.png) [@ToddZ](https://meta.discourse.org/u/ToddZ)
#### Post date: [November 6, 2025, 8:46pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/10 "2025-11-06T20:46:05Z")

</div>

I’ve been ignoring these:

```plaintext
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-ASN.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-ASN.mmdb
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-City.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-City.mmdb

```

…but just came looking for a way to suppress them.

I could just [configure MaxMind](https://meta.discourse.org/t/configure-maxmind-for-reverse-ip-lookups/173941), but I don’t really _need_ it.

The [PR](https://github.com/discourse/discourse/pull/18993) above was merged 2023-11-23 – should I not be seeing these errors?

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [November 6, 2025, 10:54pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/11 "2025-11-06T22:54:40Z")

</div>

> [@ToddZ](#):
>
> The [PR](https://github.com/discourse/discourse/pull/18993) above was merged 2023-11-23 – should I not be seeing these errors?

It was reverted again since it was too complicated to adjust automated tests for them. An attempt was made, but those re-added the warnings, breaking the purpose of my PR in the first place:

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

Hence both reverted:

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

The problem most likely was to make reading the database depending of the existence of a MaxMind key. The database however can be added other ways. On our own instance, in the meantime we add [free DB-IP databases](https://db-ip.com/db/lite.php), which do not require an account. So my own PR would have broken the way we do it now. The same caused failing tests which I fixed in my PR. But on the main branch and/or in certain plugins this likely caused other issues.

A better solution, if someone wants to approach this again, would be to check whether the database files exist, before attempting to load them, instead of whether the license key is defined. So here:

> <https://github.com/discourse/discourse/blob/main/lib/discourse_ip_info.rb#L13-L17>

- Only if `File.join(path, "GeoLite2-City.mmdb")` exists, `mmdb_load` it.

The adjusted GUI output might have been an issue as well for some tests, but it should be possible to add it without breaking tests, as a fallback only if no location is available and then the respective flag is true (the one I set with `ret[:no_license] = true` in my PR). But should be renamed to `no_db` or so to indicate that it is not about whether a MaxMind license key has been defined, but whether the actual database files exist or not. That way, unit tests can inject a location to test the output without requiring an actual database, and no license key anyway.

---

<div class="post-metadata">

### Author: ![ToddZ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toddz/32/328350_2.png) [@ToddZ](https://meta.discourse.org/u/ToddZ)
#### Post date: [November 6, 2025, 11:53pm UTC](https://meta.discourse.org/t/maxminddb-not-found-error/148512/12 "2025-11-06T23:53:24Z")

</div>

Thanks for the info! Seems sensible to check for files before trying to load them. I’m not the guy to develop a fix, so I’ll try enabling MaxMind to declutter my log.
