"error": "missing required parameter \"q\"" when running multiple InfluxDB queries

Grafana version: v3.1.1 (commit: a4d2708)
InfluxDB version: 1.0.2
Linux version (from uname -r): 4.4.51-40.58.amzn1.x86_64

I’m getting this error when attempting to run multiple InfluxDB queries.

“error”: “missing required parameter “q””,
“message”: “missing required parameter “q””

The first query (A) is defined as this:

SELECT non_negative_derivative(mean(bytes_recv),1s)*8 as "in" FROM "net" WHERE cloud_application_name =~ /$app/ AND interface =~ /(vlan|eth|bond).*/ AND $timeFilter GROUP BY time($interval), * fill(none)

The second query (B) is defined as this:

SELECT non_negative_derivative(mean(bytes_sent),1s)*8 as "out" FROM "net" WHERE cloud_application_name =~ /$app/ AND interface =~ /(vlan|eth|bond).*/ AND $timeFilter GROUP BY time($interval), * fill(none)

Both of these queries work fine and show data in the chart as long as they are the only queries defined (i.e., as query A, with no query B).

With both of these queries defined (as queries A and B), and with both of them enabled, I don’t see any errors. However, I only see data for the first query. If I disable the first query, I get the error (for query B). The problem appears to be related to the semicolon added to the beginning of the second query, which is encoded as %3B in the URL sent to Grafana. If I remove the semicolon in the URL, then the query seems to work (at least I see JSON-formatted output and no error).

Below is an example of the URL sent to Grafana with the first query (A) disabled (and with proprietary info substituted with generic text). Note the “%3B” encoded character before the SELECT statement.

https://<host where grafana is running>/grafana/api/datasources/proxy/1/query?db=telegraf&q=%3BSELECT%20non_negative_derivative(mean(bytes_sent)%2C1s)*8%20as%20%22out%22%20FROM%20%22net%22%20WHERE%20cloud_application_name%20%3D~%20%2F<service name>%2F%20AND%20interface%20%3D~%20%2F(vlan%7Ceth%7Cbond).*%2F%20AND%20time%20%3E%20now()%20-%206h%20GROUP%20BY%20time(5m)%2C%20*%20fill(none)&epoch=ms

The problems below sound similar in respect to parsing problems for multiple queries, but the exact errors are different.

[Feat] Support for InfluxDB 0.11.1 Multiple query syntax #4533
[0.12.0] Error parsing query when running multiple queries #6220

Any ideas? Are we running with an unsupported Grafana/InfluxDB combo? Should I submit this as a new bug?

this looks like an old bug (fixed in master) where you get this error if you disable all queries (with the eye icon).

Yes, it’s the same error as with the problem you mention, but it’s not the same problem. Only the first query was disabled with the eye icon. You can see the second query in the URL, which I had pasted into my posting. There’s an encoded semicolon (%3B) before the SELECT statement. If I remove that then the URL seems to work.

I also never see data for the second query with both queries enabled. I know semicolons are valid delimiters with InfluxDB because I can submit multiple queries directly to InfluxDB delimited by semicolons. I just can’t get the multiple queries working through Grafana.

V3.1.1 is nearly a year old. Is it possible for you to upgrade your Grafana and see if that solves the issue?

Thanks for the reply. I was a little afraid someone might suggest that. The installs are handled by another team and this won’t be high on their list of priorities right now. But yeah, we’ll do that at some point and then I can revisit this issue then. For the time being I guess we’ll need to work around the issue by never using multiple queries for one chart.