Canvas 6.6 Markup Expression rendering error

My markup is getting the following error:

" Expression rendering error

Markdown modelArgs Error: The modelArgs value is empty. Either it should contain an arg, or a model should not be used in the expression."

My query is using conditional colouring, see below:

filters
| timelion
query=".sum(.es(index='devops-jenkins*', q='(iipm.it_executive:"name") AND (data.result:SUCCESS) AND (data.buildVariables.NODE_NAME:????_Agent_zOS)', metric=avg:data.buildDuration).divide(60000).fit(nearest)
| math "mean(value)"
| markdown "|||||||||||||||||||||||||||"
font={font family="'Arial', Helvetica, Arial, sans-serif" size=20 align="center" color={switch case={case if={all {gte 0} {lte 10}} then="#7CFC00"} case={case if={all {gte 11} {lte 29}} then="#87CFFA"} case={case if={all {gte 30} {lte 59}} then="#FFA500"} case={case if={all {gte 60} {lte 119}} then="#FFD700"} case={case if={gte 120} then="#FF0000"} default="red"} weight="normal" underline=false italic=false}
| render containerStyle={containerStyle backgroundColor="#00008B"}

What is that with the error message at the top?

My markup is in a Canvas, it uses conditional colouring for the fonts. Looks working fine. However the error message makes me feel uneasy.

Hi @maolopez -- Are you on a version of Kibana prior to 6.7?

Sounds like you might be running into this issue, which was resolved in this PR and merged for release in 6.7.

@lukeelmers Thanks a lot for your reply. Yes our entire stack is 6.6. Not sure if we want to upgrade the entire ELK to 6.7. in Prod just for this small bug. Is there a more clear work around for this issue in markups? . Much appreciated.

I see the "Expression rendering error" is happening in the markup because of the "| math "mean(value)" .. However, if i take it out then my conditional colouring stops working. Any ideas?

Also, deleting "| math "mean(value)" and replacing the markdown content with: ||||| {{math "mean(value)"}}

gives me "Math error, first argument must be an array". but i just need the mean calculation of my column "value"

Not sure I understand what you are asking -- so in the expression above you are now running into a different error stemming from the math function?

Is it possible that the values passed to math "mean(value)" are ever null or otherwise missing?

What is the output if you just execute the expression up to the math function? e.g.

filters
| timelion
query=".sum(.es(index='devops-jenkins*', q='(iipm.it_executive:"name") AND (data.result:SUCCESS) AND (data.buildVariables.NODE_NAME:????_Agent_zOS)', metric=avg:data.buildDuration).divide(60000).fit(nearest)
| math "mean(value)"
| render

Or with that fails, what do you get without math?

filters
| timelion
query=".sum(.es(index='devops-jenkins*', q='(iipm.it_executive:"name") AND (data.result:SUCCESS) AND (data.buildVariables.NODE_NAME:????_Agent_zOS)', metric=avg:data.buildDuration).divide(60000).fit(nearest)
| render

Hey I solved it like below:

filters
| timelion
query (any query)
| staticColumn "average" value={math "mean(value)"}
| mapColumn "maturity"
fn={getCell "average" | switch {case if={compare "gte" to=120} then="M1"} {case if={all {gte 60} {lte 119}} then="M2"} {case if={all {gte 30} {lte 59}} then="M3"} {case if={all {gte 11} {lte 29}} then="M4"} {case if={all {gte 0} {lte 10}} then="M5"}}
| mapColumn "color"
fn={getCell "value" | switch {case if={all {gte 0} {lte 10}} then="#7CFC00"} {case if={all {gte 11} {lte 29}} then="#87CFFA"} {case if={all {gte 30} {lte 59}} then="#FFA500"} {case if={all {gte 60} {lte 119}} then="#FFD700"} {case if={gte 120} then="#FF0000"}}
| markdown "{{#each rows}}{{maturity}}{{/each}}"
font={font family="'Arial', Helvetica, Arial, sans-serif" size=48 align="center" color={getCell "value" | switch {case if={all {gte 0} {lte 10}} then="#7CFC00"} {case if={all {gte 11} {lte 29}} then="#87CFFA"} {case if={all {gte 30} {lte 59}} then="#FFA500"} {case if={all {gte 60} {lte 119}} then="#FFD700"} {case if={gte 120} then="#FF0000"}} weight="normal" underline=false italic=false}
| render containerStyle={containerStyle backgroundColor="#000000"} css=".canvasRenderEl {

}"

I don't get the rendering error anymore. Thanks anyways!, close this case please.