# Canvas 6.6 Markup Expression rendering error

**URL:** <https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [July 5, 2019, 7:30pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161 "2019-07-05T19:30:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 5, 2019, 7:30pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/1 "2019-07-05T19:30:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 5, 2019, 7:35pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/2 "2019-07-05T19:35:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [July 5, 2019, 10:26pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/3 "2019-07-05T22:26:30Z")

</div>

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

Sounds like you might be running into [this issue](https://github.com/elastic/kibana/issues/28962), which was resolved in [this PR](https://github.com/elastic/kibana/pull/28963) and merged for release in `6.7`.

---

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 8, 2019, 1:28pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/4 "2019-07-08T13:28:23Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 8, 2019, 3:34pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/5 "2019-07-08T15:34:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 8, 2019, 3:53pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/6 "2019-07-08T15:53:26Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [July 9, 2019, 8:03pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/7 "2019-07-09T20:03:09Z")

</div>

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 `value`s 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.

```auto
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`?

```auto
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

```

---

<div class="post-metadata">

**Author:** ![maolopez](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@maolopez](https://discuss.elastic.co/u/maolopez)\
**Post date:** [July 12, 2019, 2:15pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/8 "2019-07-12T14:15:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 9, 2019, 2:15pm UTC](https://discuss.elastic.co/t/canvas-6-6-markup-expression-rendering-error/189161/9 "2019-08-09T14:15:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
