opened 02:25AM - 27 Feb 24 UTC
### What happened?
I was trying to understand what labels a metric had. The …metric is counter. I changed the options to be an instant query so I could use a table to view the labels. When I ran the query, I got an error in the UI that didn't make much sense to me. I pulled out some of my very rusty Chrome debug tooling skills, and I found the location of the [exception here](https://github.com/grafana/grafana/blob/93fef224ae5d28100a47b37338c9ff18a52d0dc9/packages/grafana-prometheus/src/query_hints.ts#L53).
![image](https://github.com/grafana/grafana/assets/11968222/64a17224-c424-4e56-a418-abc4008ae68a)
Error on the UI:
```
An unexpected error happened
Details
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at N (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:5608:8893)
at WithTheme(undefined)
at div
at g (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:5818:3850)
at div
at m (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:26:25711)
at u (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:26:23378)
at https://grafana.example.com/public/build/1697.ba74e2de8c65e37f1de4.js:98:4683
at Ta (https://grafana.example.com/public/build/1697.ba74e2de8c65e37f1de4.js:98:6910)
at i (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:1:172)
at o (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
at g (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:119350)
at div
at div
at div
at fs (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:25127)
at It (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:187:4993)
at za (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:29667)
at Rs (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:29797)
at E (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:425:68)
at div
at K (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:4108:820)
at div
at mu (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:30083)
at It (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:187:4993)
at y (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:187:2689)
at Xo (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:12772)
at ft (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:66:950)
at Oa (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:14520)
at g (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:4109:6041)
at pr (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:412:1457)
at div
at r (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:212:37013)
at div
at fe (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:1:13243)
at div
at div
at div
at q (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:36551)
at u (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:29691)
at div
at div
at yo (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:1:9959)
at ui (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:628:3974)
at Ut (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:183:66326)
at WithTheme(Connect(ui))
at div
at div
at div
at q (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:124:36551)
at u (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:29691)
at fi (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:634:32)
at Ut (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:183:66326)
at o (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
at g (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:119350)
at div
at i (https://grafana.example.com/public/build/8474.aca7493112eb29aea9e3.js:1:2301)
at div
at i (https://grafana.example.com/public/build/8474.aca7493112eb29aea9e3.js:1:4289)
at _ (https://grafana.example.com/public/build/8474.aca7493112eb29aea9e3.js:1:9608)
at div
at wi (https://grafana.example.com/public/build/explore.912acd25b8df4488f4c7.js:634:2477)
at Suspense
at o (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
at Gc (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:5420:9842)
at ve (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:228:23578)
at la (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:209:4728)
at Zn (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:209:10219)
at el (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:228:11773)
at ve (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:228:25773)
at div
at div
at main
at div
at ag (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:5420:2407)
at la (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:209:4728)
at Zn (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:209:10219)
at _n (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:209:9608)
at Il (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:228:12072)
at ve (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:228:19749)
at div
at i (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:212:13888)
at v (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:41:14038)
at p (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:662:233850)
at c (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:566:21348)
at o (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
at g (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:192:119350)
at Re (https://grafana.example.com/public/build/9733.976a8afd1c8ec137399a.js:187:529)
at Eu (https://grafana.example.com/public/build/8378.36d9cd16557e09d3c339.js:5431:122)
```
I could get around this by just adding rate to the metric. The error then goes away even though I only need an instant query.
### What did you expect to happen?
I expected to be given a metric with labels as I wasn't looking for more than a single data point and just wanted a table with labels of the single data point but instead, I was given an error in the UI.
![image](https://github.com/grafana/grafana/assets/11968222/bce7352f-630b-4505-83c2-c8f8580cfba2)
### Did this work before?
Yes, I have used this many times before for work, but this was at my house and I hadn't seen it there before. I use watchtower to keep my Grafana updated and I am running the latest.
### How do we reproduce it?
1. Find a metric that is a counter
2. Change query to be an instance query but do not add rate
3. execute query and an error should happen
4. Refresh tab, add rate to metric and run again, there should be no error.
the
### Is the bug inside a dashboard panel?
No, explore page.
### Environment (with versions)?
Grafana:
Grafana v10.3.3 (252761264e)
Running Grafana image on Docker for Mac using OrbStack
OS: Mac M2 Sonoma 14.3.1
Browser: Google Chrome Version 121.0.6167.189
OS: Windows 11
### Grafana platform?
Docker
### Datasource(s)?
Prometheus