"undefined identifier policies" warning after migration from Grafana OSS 9.4.3 to 9.5.1

  • What Grafana version and what operating system are you using?
    Grafana Server OSS Version 9.5.1 (commit: bc353e4b2d, branch: HEAD)
    Linux collect 5.15.0-69-generic #76-Ubuntu
    InfluxDB v2.7.0 (git: 85f725f8b9) build_date: 2023-04-05T15:32:25Z

  • What are you trying to achieve?
    Displaying a dashboard with several panels, which did not generate the warning before moving to 9.5.1

  • How are you trying to achieve it?

  • What happened?
    For every panel in the dashboard I get the following message - but panels are display correctly
    2023-04-27T19:22:27.367143+00:00 collect grafana[4135094]: logger=tsdb.influx_flux t=2023-04-27T19:22:27.367084995Z level=warn msg=“Flux query failed” err=“invalid: error @1:1-1:5: undefined identifier SHOW\n\nerror @1:6-1:15: undefined identifier RETENTION\n\nerror @1:16-1:24: undefined identifier POLICIES\n\nerror @1:25-1:27: undefined identifier on” query=“SHOW RETENTION POLICIES on "undefined"”

  • What did you expect to happen?
    no warning, as with 9.4.3

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?


Yep I’ve got the same issue with the same upgrade.

Am wondering if this is limited to 9.5.1. I checked the InfluxDB dashboard which has multiple panels using Flux and no errors, but it’s using 9.5.0

Well, I use InfluxDB 2 and query it from Grafana with Flux, leading to these warnings. The message however complains about an InfluxQL syntax. Why is this merged in one transaction?

Where in the above message does it reference InfluxQL?


At least this “SHOW RETENTION POLICIES” does not look like Flux to me.

Might be good to check breaking changed thread , there is something there for retention policely

Having the same issue. Take a look at the query_builder.ts:

else if (type === ‘RETENTION POLICIES’) {
query = ‘SHOW RETENTION POLICIES on "’ + this.database + ‘"’;
return query;

Really not good.

Welcome @martinfandel to the Grafana forum.

See here.

I think this means you must create a new YAML file per these instructions.

I’ve added a provisioning file just for the datasource which worked. Unfortunately, all my config is lost. All dashboards, all alertings etc… Also if I disable provisioning again, still lost. Can I get them back somehow? Thx

So to be more precise, all queries have been lost.It has been replaced with random data. Thats not so nice.

In export json the queries are still there :slight_smile:

@grant2 I followed your advice, now I have only datasources in Grafana where the field “database” is empty. But still I get plenty of error messages that “Flux query failed” on something like this:

"invalid: error @1:1-1:5┤
: undefined identifier SHOW\n\nerror @1:6-1:15: undefined identifier RETENTION\n\nerror @1:16-1:24: undefined identifier POLICIES\n\nerror @1:25-1:27: undefined identifier on" quer┤
y="SHOW RETENTION POLICIES on \"undefined\""

It is now only complaining about the “on undefined” or “on ‘’” (empty name) – the database names that were still provisioned before in the datasources do not appear any more in the error messages.

@martinfandel For me there was an easier way to remove the database name for InfluxDB V2 datasources:

  1. Open the data source in the GUI
  2. Change “Query Language” from “Flux” to “InfluxQL”
  3. Remove the database name in the field down in the form
  4. Change "Query Language back “Flex”
  5. Hit “Save & test”

Without the database name, I’m still getting the SHOR RETENTION errors…

I can’t provisioning the dashboard, because the flowchart plugin mappings are not compatible with it yet. I’m trying to fix the alerting now. Because the UUID has changed to. Also the format of the UUID.

Interesting. If I configure the alerting through provisioning and remove the config afterwards, I cant get rid of it in grafana. Is there a special procedure for this?

I configured it from scratch again. Error with RETENTION is still there:


Hi, I am also seeing this same error message in grafana 9.5.2 when trying to query influxdb2 with flux. This only started recently but I don’t know how to fix it. If I switch my influxdb2 data source to InfluxQL query language, it doesn’t have a ‘database’ name defined as mentioned above.

I have Grafana OSS v9.4 running on a test machine, and also InfluxDB (Flux) v2.6 on the same machine. This weekend, I will do my update to v9.5.2 and see if I encounter the same error message, and if so, how I might be able to resolve it.

Same issue seen here with Grafana v9.5.2 and Influx v2.7.1.

Still present in Grafana 10.0.0 in combination with InfuxDB 2.7.1