# Randomly crashes due to a TypeError - no implicit conversion of nil into Integer

**URL:** https://discuss.elastic.co/t/randomly-crashes-due-to-a-typeerror-no-implicit-conversion-of-nil-into-integer/225420
**Category:** Logstash
**Created:** [March 27, 2020, 2:05pm UTC](https://discuss.elastic.co/t/randomly-crashes-due-to-a-typeerror-no-implicit-conversion-of-nil-into-integer/225420 "2020-03-27T14:05:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rohe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohe/32/48235_2.png) [@rohe](https://discuss.elastic.co/u/rohe)
#### Post date: [March 27, 2020, 2:05pm UTC](https://discuss.elastic.co/t/randomly-crashes-due-to-a-typeerror-no-implicit-conversion-of-nil-into-integer/225420/1 "2020-03-27T14:05:23Z")

</div>

Hello

I am using logstash 7.3.0, which is configured to read input from Kafka and output to elasticsearch or a different Kafka topic in certain cases. My config is as follows:

```auto
    input {
      kafka {
        bootstrap_servers => "...."
        client_id => "logstash-1"
        auto_offset_reset => "earliest"
        consumer_threads => 3
        topics => ["logs"]
        codec => "json"
      }
    }

    filter {
      date {
        match => ["timestamp", "UNIX"]
        remove_field => ["timestamp", "@version"]
      }
      if (![domain]) {
    	mutate {
    	    copy => { "email" => "temp" }
    	}
    	mutate {
    	    split => { "temp" => "@" }
    	}
    	mutate {
    	    add_field => {"domain" => "%{[temp][1]}"}
    	    remove_field => ["temp"]
    	}
      }
    }

    output {
      if (!([category]) or ([category] and [category] > 700)) {
        kafka {
          codec => "json"
          topic_id => "logs-1"
          bootstrap_servers => "...."
        }
      } else {
        elasticsearch {
          ilm_enabled => false
          user => "..."
      	  password => "..."
    	  manage_template => false
          hosts => [ 
            "..."
          ]    
          index => "logs"
        }
      }
    }

```

It randomly stops working due to a "TypeError - no implicit conversion of nil into Integer" error. I tried troubleshooting each part to reproduce the problem, but I can't seem to do so. It seems that no part of this configuration would crash in case of a nil value like the error says.

I would appreciate any advice. Thanks!

Below is the full error output:

```auto
[2020-03-27T10:34:51,966][ERROR][org.logstash.execution.WorkerLoop] Exception in pipelineworker, the pipeline stopped processing new events, please check your filter configuration and restart Logstash.
org.jruby.exceptions.TypeError: (TypeError) no implicit conversion of nil into Integer
	at usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:239) ~[?:?]
warning: thread "[main]>worker7" terminated with exception (report_on_exception is true):
java.lang.IllegalStateException: org.jruby.exceptions.TypeError: (TypeError) no implicit conversion of nil into Integer
	at org.logstash.execution.WorkerLoop.run(org/logstash/execution/WorkerLoop.java:85)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:566)
	at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:440)
	at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:304)
	at usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:239)
	at org.jruby.RubyProc.call(org/jruby/RubyProc.java:295)
	at org.jruby.RubyProc.call(org/jruby/RubyProc.java:274)
	at org.jruby.RubyProc.call(org/jruby/RubyProc.java:270)
	at java.lang.Thread.run(java/lang/Thread.java:834)
Caused by: org.jruby.exceptions.TypeError: (TypeError) no implicit conversion of nil into Integer
	at usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:239)
[2020-03-27T10:34:52,141][FATAL][logstash.runner] An unexpected error occurred! {:error=>java.lang.IllegalStateException: org.jruby.exceptions.TypeError: (TypeError) no implicit conversion of nil into Integer, :backtrace=>["org.logstash.execution.WorkerLoop.run(org/logstash/execution/WorkerLoop.java:85)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)", "jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:566)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:440)", "org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:304)", "usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:239)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:295)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:274)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:270)", "java.lang.Thread.run(java/lang/Thread.java:834)"]}

```

---

<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: [April 24, 2020, 2:05pm UTC](https://discuss.elastic.co/t/randomly-crashes-due-to-a-typeerror-no-implicit-conversion-of-nil-into-integer/225420/2 "2020-04-24T14:05:30Z")

</div>

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