# Elastic Runetime Error ScriptException

**URL:** <https://discuss.elastic.co/t/elastic-runetime-error-scriptexception/112880>\
**Category:** Elasticsearch\
**Created:** [December 21, 2017, 6:58pm UTC](https://discuss.elastic.co/t/elastic-runetime-error-scriptexception/112880 "2017-12-21T18:58:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricigliano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ricigliano/32/23041_2.png) [@Ricigliano](https://discuss.elastic.co/u/Ricigliano)\
**Post date:** [December 21, 2017, 6:58pm UTC](https://discuss.elastic.co/t/elastic-runetime-error-scriptexception/112880/1 "2017-12-21T18:58:57Z")

</div>

I am getting this error in the Elasticsearch logs, does anyone what this is from:

[2017-12-21T10:57:21,040][ERROR][o.e.x.w.t.s.ExecutableScriptTransform] [4mjFsbb] failed to execute [script] transform for [v4VKEfxATo-5dDLbaIaBHA\_elasticsearch\_cluster\_status\_c881aff0-545b-4715-8c9d-da651d965bc5-2017-12-21T18:57:20.987Z]  
org.elasticsearch.script.ScriptException: runtime error  
at org.elasticsearch.painless.PainlessScript.convertToScriptException(PainlessScript.java:101) ~[?:?]  
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email\_recipient = (ctx.payload.kibana\_settings.hits.total \> 0) ? ctx.payload.kibana\_settings.hits.hits[0].\_source.kibana\_settings.xpack.default\_admin\_email : null;ctx.vars.is\_new = ctx.vars.fails\_check && !ctx.vars.not\_resolved;ctx.vars.is\_resolve ...:1070) ~[?:?]  
at org.elasticsearch.painless.ScriptImpl.run(ScriptImpl.java:105) ~[?:?]  
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.doExecute(ExecutableScriptTransform.java:69) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:53) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:38) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:471) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:313) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$7(ExecutionService.java:416) ~[x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:568) [x-pack-6.0.0-rc1.jar:6.0.0-rc1]  
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-6.0.0-rc1.jar:6.0.0-rc1]  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0\_60]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0\_60]  
at java.lang.Thread.run(Thread.java:745) [?:1.8.0\_60]  
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0  
at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[?:1.8.0\_60]  
at java.util.ArrayList.get(ArrayList.java:429) ~[?:1.8.0\_60]  
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email\_recipient = (ctx.payload.kibana\_settings.hits.total \> 0) ? ctx.payload.kibana\_settings.hits.hits[0].\_source.kibana\_settings.xpack.default\_admin\_email : null;ctx.vars.is\_new = ctx.vars.fails\_check && !ctx.vars.not\_resolved;ctx.vars.is\_resolve ...:347) ~[?:?]

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 21, 2017, 7:24pm UTC](https://discuss.elastic.co/t/elastic-runetime-error-scriptexception/112880/2 "2017-12-21T19:24:49Z")

</div>

hits.total is not representative of how many results are actually returned in hits. For example, you could set size=0 (thus hits.hits will be zero length), but total would not change regardless of the size parameter. What is the query you are running to generate ctx.payload.kibana\_settings?

---

<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:** [January 18, 2018, 7:25pm UTC](https://discuss.elastic.co/t/elastic-runetime-error-scriptexception/112880/3 "2018-01-18T19:25:29Z")

</div>

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