# InfluxDB Error: retention policy not found: autogen

**URL:** <https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352>\
**Category:** Systems\
**Created:** [September 1, 2022, 7:23am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352 "2022-09-01T07:23:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![testmailnew](https://avatars.discourse-cdn.com/v4/letter/t/e480ec/32.png) [@testmailnew](https://community.influxdata.com/u/testmailnew)\
**Post date:** [September 1, 2022, 7:23am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/1 "2022-09-01T07:23:39Z")

</div>

InfluxDB Error: retention policy not found: autogen

grafana 9.1 with influxdb 2.4

How to fix this problem ?

 ![屏幕截图 2022-09-01 152152](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/b/ba67a76b7952a12c191e01b0db8c3ea31d3c7192.png)

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [September 1, 2022, 10:48am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/2 "2022-09-01T10:48:22Z")

</div>

_autogen_ is the name of the default retention policy (if enabled).

What’s the default RP you set on InfluxDB? (run `SHOW RETENTION POLICIES`)

The solution is pretty simple… just specify it `SELECT * FROM _RetPoliciy_.cpu`

---

<div class="post-metadata">

**Author:** ![Wisdom](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@Wisdom](https://community.influxdata.com/u/Wisdom)\
**Post date:** [September 4, 2022, 8:15am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/3 "2022-09-04T08:15:37Z")

</div>

I got same error, and will share what I have tested.

At Influxdb I run:

```auto
influx v1 dbrp list

```

Then see all buckets using the **autogen** “ **Retention Policy** ”.

But, if I do same check using:

```auto
influx bucket list

```

The field / collumn “ **Retention Policy** ” does not exists.

I have tried switch on **Query Language** at **Data Sources** :

From **InfluxQL** to **Flux**

Then no happen the error:

```auto
runRequest.ts:151 runRequest.catchError {"message":"InfluxDB Error: retention policy not found: autogen"}

```

But instead, got a new error:

`fetch.js:32 POST https://grafana.domain.com/api/ds/query 400`

In the **Explore** Menu I can query Influxdb using use option **Sample Query** from **Flux** , but server start flood with this error from **/api/ds/query**.

Everything seems ok at InfluxDB side, the default dashboard (from InfluxDB no Grafana) use the data from buckets, and query works too.

Using Postman on [https://influxdb.domain.com/api/v2/dbrps?org=ORGNAME](https://influxdb.domain.com/api/v2/dbrps?org=ORGNAME) returns:

```auto
{
    "content": [
        {
            "id": "xxxxxxxxxxxxxxxx",
            "database": "database",
            "retention_policy": "autogen",
            "default": true,
            "virtual": true,
            "orgID": "xxxxxxxxxxxxxxxx",
            "bucketID": "xxxxxxxxxxxxxxxx"
        }
    ]
}

```

PS.: On my setup I did subdomains for influxdb and grafana. CORS is using the “\*”.

---

<div class="post-metadata">

**Author:** ![howdoI](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@howdoI](https://community.influxdata.com/u/howdoI)\
**Post date:** [September 5, 2022, 8:50am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/4 "2022-09-05T08:50:20Z")

</div>

Hi there !

I found a solution to the problem that I also encountered. The issue was in my Datasource definition on Grafana in the Query Language option.

I had selected in “Query Language” the InfluxQL option. I finally figured that all I did on InfluxDB was with Flux query language, so it would make more sense using Flux on Grafana too.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/b/beb78609f2d0b023a954b6ccd5d22db91e588f0a.png)

Changed it and it now works perfectly !!  
It also makes more sense because it includes the API Token in the Datasource form directly.

---

<div class="post-metadata">

**Author:** ![Wisdom](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@Wisdom](https://community.influxdata.com/u/Wisdom)\
**Post date:** [September 5, 2022, 9:32am UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/5 "2022-09-05T09:32:18Z")

</div>

I have found the solution at grafana forum on this link:

[https://community.grafana.com/t/database-not-found-error-grafana-influxdb-source/61064](https://community.grafana.com/t/database-not-found-error-grafana-influxdb-source/61064)

My guess, grafana fails on check the flags **Retention Policy** and **Default** … Why?

After follow the setup from medium post (link at grafana forums) I have checked the changes with:

`influx v1 dbrp list`

Then **Retention Policy** need be **autogen** and **Default** need be **false** or don’t work. (Before was **autogen** and **true** )

Now I’m searching why the error using **Flux** option at my setup happens.

The old **InfluxQL** now it’s working, but I wish fix the second option too.

---

<div class="post-metadata">

**Author:** ![JudsonM](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/judsonm/32/11012_2.png) [@JudsonM](https://community.influxdata.com/u/JudsonM)\
**Post date:** [September 15, 2022, 6:34pm UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/6 "2022-09-15T18:34:07Z")

</div>

I would like to chime in here because i have been getting this error “InfluxDB Error: retention policy not found: autogen” as well. In my case. I have an ton of old dashboards on a older Grafana 8.4.2 and InfluxDB 1.8.10 setup.

I had decided to work toward updating and started using the Grafana 9.1.5 and InfluxDB 2.4.0 in a Docker container which in itself so far is a learning curve but isn’t to bad. Although I do wish I could use the Flux language for the plugin, the Fact is I have so many dashboards built on the older InfluxQL language that I don’t want to rebuild.

Any how, after configuring telegraf to point to the new influxDB v2 output plugin and configuring grafana for the Influx Data source I came across this error in about the autgen policy not found. I have spent the week trying to work through or work around it and figure it out, but I finally I saw @Wisdom 's post that the retention policy for autogen needs to NOT be “default” which finally allowed my dashboard to load!!

In fumbling around trying to set the autogen policy to false i couldn’t seem to update this existing read only policy, so in the end what worked for me was creating a new policy (apparently it is default) but isn’t read only …this changes the read only autogen policy to default = false, but attempts to remove this duplicate new non-readonly autogen policy break my dashboard again so apparently it must be there.

Before:

```auto
root@b38e3b8e242d:/# influx v1 dbrp ls
ID Database Bucket ID Retention Policy Default Organization ID

VIRTUAL DBRP MAPPINGS (READ-ONLY)

ID Database Bucket ID Retention Policy Default Organization ID
9fe148f3e30ddec3 _monitoring 9fe148f3e30ddec3 autogen true 2d0717a9a02a4d9e
9199596572587bde _tasks 9199596572587bde autogen true 2d0717a9a02a4d9e
80731b030126e621 telegraf 80731b030126e621 autogen true 2d0717a9a02a4d9e

```

Create retention policy with this command

```auto
root@b38e3b8e242d:/# influx v1 dbrp create \
> --db telegraf \
> --rp autogen \
> --bucket-id 80731b030126e621
ID Database Bucket ID Retention Policy Default Organization ID
09fc9637efc75000 telegraf 80731b030126e621 autogen true 2d0717a9a02a4d9

```

After:

```auto
root@b38e3b8e242d:/# influx v1 dbrp ls
ID Database Bucket ID Retention Policy Default Organization ID
09fc9637efc75000 telegraf 80731b030126e621 autogen true 2d0717a9a02a4d9e

VIRTUAL DBRP MAPPINGS (READ-ONLY)

ID Database Bucket ID Retention Policy Default Organization ID
9fe148f3e30ddec3 _monitoring 9fe148f3e30ddec3 autogen true 2d0717a9a02a4d9e
9199596572587bde _tasks 9199596572587bde autogen true 2d0717a9a02a4d9e
80731b030126e621 telegraf 80731b030126e621 autogen false 2d0717a9a02a4d9e

```

I’m still not sure which one it’s using but considering it broke when i tried to remove the new autogen = true policy i believe it is that one

---

<div class="post-metadata">

**Author:** ![fdorssers](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@fdorssers](https://community.influxdata.com/u/fdorssers)\
**Post date:** [November 2, 2022, 7:01pm UTC](https://community.influxdata.com/t/influxdb-error-retention-policy-not-found-autogen/26352/7 "2022-11-02T19:01:20Z")

</div>

Awesome, thanks! That also solved it for me. Was also running a fresh 2.4 instance.

Before, which didn’t work and just caused the missing autogen error everywhere:

```auto
user@pc:~$ influx v1 dbrp list
ID Database Bucket ID Retention Policy Default Organization ID

VIRTUAL DBRP MAPPINGS (READ-ONLY)
----------------------------------
ID Database Bucket ID Retention Policy Default Organization ID
46896f35921cd549 _monitoring 46896f35921cd549 autogen true 213d4e1072307065
62ad043c97265540 _tasks 62ad043c97265540 autogen true 213d4e1072307065
a7e2192365f4385d homeassistant a7e2192365f4385d autogen true 213d4e1072307065
97a76f92708d4527 quickstart 97a76f92708d4527 autogen true 213d4e1072307065

```

Added the explicit mapping:

```auto
user@pc:~$ influx v1 dbrp create --db homeassistant --rp autogen --bucket-id a7e2192365f4385d
ID Database Bucket ID Retention Policy Default Organization ID
0a3a6b8c5a474000 homeassistant a7e2192365f4385d autogen true 213d4e1072307065

```

And got:

```auto
user@pc:~$ influx v1 dbrp list
ID Database Bucket ID Retention Policy Default Organization ID
0a3a6b8c5a474000 homeassistant a7e2192365f4385d autogen true 213d4e1072307065

VIRTUAL DBRP MAPPINGS (READ-ONLY)
----------------------------------
ID Database Bucket ID Retention Policy Default Organization ID
46896f35921cd549 _monitoring 46896f35921cd549 autogen true 213d4e1072307065
62ad043c97265540 _tasks 62ad043c97265540 autogen true 213d4e1072307065
a7e2192365f4385d homeassistant a7e2192365f4385d autogen false 213d4e1072307065
97a76f92708d4527 quickstart 97a76f92708d4527 autogen true 213d4e1072307065

```

And now everything was working properly. Grafana, old Python client, everything.
