Parse error at char 4: unexpected character: '\ufeff'"

Hello,
I am running a grafana server 7.3.5 on a Ubuntu 18.04.5 system to visualize metrics from a ceph server via prometheus. I downloaded a dashboard #9550 for this purpose which works fine. Now I wanted to expand this dashboard with a new panel.
So I create a new panel and then paste a Metric expression from an already existing and working panel into the new one:
sum(rate(ceph_osd_op_r{job="$job"}[$interval]))
I select prometheus as data source just like in the original panel and add a panel-name. Now comes the strange behavior. I tried his say 30 times and in some cases (perhaps 3 times) a saw the data visualisation as expected and in the rest I only get a strange error from query explorer:

request:Object
url:"api/datasources/proxy/1/api/v1/query_range?query=sum%EF%BB%BF(%EF%BB%BFrate%EF%BB%BF(%EF%BB%BFceph_osd_op_r%EF%BB%BF%7B%EF%BB%BFjob%EF%BB%BF%3D%EF%BB%BF%22ceph%22%EF%BB%BF%7D%EF%BB%BF%5B30s%5D%EF%BB%BF)%EF%BB%BF)&start=1608193020&end=1608196620&step=15"
method:"GET"
hideFromInspector:false
response:Object
status:"error"
errorType:"bad_data"
error:"parse error at char 4: unexpected character: '\ufeff'"
message:"parse error at char 4: unexpected character: '\ufeff'"

I always copy and paste the very same Metrics-expression into the panel. There are a few other people reporting the same issue, but I did not find any hint what this problem is all about and how to solve it? Any ideas?

Thanks Rainer

Hello ,

I had same issue with grafana 7 , i can’t manipulate dashboard with this behavior , any suggestions to fix that .

2 Likes

Hi @krienke,

Thanks for opening this post.

Hmm, so normally there are a lot variables used when importing such dashboards. It might be the case that when you copy that query which you want to visualize, may have a variable which is not able to get picked up as it is defined there (usually in Dashboard → Settings icon on-top → variables).

Can you please recheck if your query needs to use variables?


Hello
I didn’t configure any variable (attached screen) , the problem happen when i try to change query from editor , and I copy paste to query to my Visual code IDE , i found a lot utf characters are added that create this kind of error

1 Like

Same issue here … (grafana 8.0.4, data-source prometheus)
It’s very annoying because, I’ve just updated an already existing query (replacing one hostname by another one) on the same dashboard and this issue just appeared.

After lot of tries, I’ve found a workaround. My issue came with my navigator (chrome Version 105.0.5195.102 (Official Build) (64-bit) ) :
With another navigator (firefox 104.0.2 (64 bits)), I don’t have this issue.

To fix, the current “corrupted requests”, you have to edit them with the JSON model editor on the dashboard (with firefox or any other web browser)

Last Thursday, I didn’t have this issue with Chrome and this morning I have this bug. Maybe I had an update …

Hi @dmihura,

Thanks for sharing the workaround !! :+1:

@daknaadnane and @krienke,

I tried to reproduce this case on my Grafana ver. 9.0.3 and here are my steps.

1- i have a dashboard configured using Prometheus with Node exporter and showing some fancy graphs.

2- I create a new panel inside the same dashboard.

3- Then select the Prometheus datasource and copy one of the query from the other panel which was showing about memory usage.

4- Paste it in my newly created panel and it seems to work without giving an errors

So this issue might be browser specific as @dmihura mentioned and also could be (both directly or indirectly) linked only for older versions.

So the suggestion would be to test this scenario on a test grafana server using the latest ver. 9.x and see if you can reproduce it there.

Let us know your results.

1 Like

Hello!
I’ve encountered the same issue yesterday.
I have to notice that only promql queues are affected. Issue is reproduced by making minor changes with keyboard in queues using chrome or edge browser. Firefox works fine.

Hey there,

This is a known issue that affects query editors when using the latest Chrome or Edge versions. You can follow the issue here. Currently we have a fix released in 9.1.4 and we’re working on releasing one for 8.5.x next week. We don’t have plans of releasing a fix for older versions, but we’re still assessing the situation.

As a workaround you can user an older browser or copy/paste the query from another text editor. Thank you!

1 Like