RefID in Math Expression with hyphens ( - ) causes internal server error

  • What Grafana version and what operating system are you using?
    Grafana version: v11.0.0
    Operating system: Windows 11 Business (version 23H2)

  • What are you trying to achieve?
    Referencing a RefID in an Expression with Operation math that has a hyphen ( - ) in it, such as $my-ref-id.

  • How are you trying to achieve it?
    In the Grafana UI when querying for a panel.

  • What happened?
    Received an icon with the text Query error: 500 Internal Server Error in the upper left corner of the panel.

  • What did you expect to happen?
    To reference the data of the RefID.

  • Can you copy/paste the configuration(s) that you are having problems with?
    $my-ref-id, I also tried ${my-ref-id}.

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

status:500
statusText:"Internal Server Error"
data:Object
message:"Query data error"
traceID:""
config:Object
traceId:undefined
message:"Query error: 500 Internal Server Error"

Just don’t use hyphens in ref id. They are interpreted as minus usually, so you will have problem in many programming languages with this syntax.

Hi @jangaraj,

Thanks for the answer.

Yes that was our conclusion as well, where we migrated from using hyphens. I was just interested if there was another workaround (such as using brace syntax) and that it maybe could be of interest to highlight this in the documentation (as the received internal server error wasn’t too precise).