# Exception in thread "\[main\]\>worker4" java.lang.ClassCastException: org.logstash.bivalues.StringBiValue cannot be cast to java.lang.String: is this a bug in logstash?

**URL:** <https://discuss.elastic.co/t/exception-in-thread-main-worker4-java-lang-classcastexception-org-logstash-bivalues-stringbivalue-cannot-be-cast-to-java-lang-string-is-this-a-bug-in-logstash/88638>\
**Category:** Logstash\
**Created:** [June 8, 2017, 12:45am UTC](https://discuss.elastic.co/t/exception-in-thread-main-worker4-java-lang-classcastexception-org-logstash-bivalues-stringbivalue-cannot-be-cast-to-java-lang-string-is-this-a-bug-in-logstash/88638 "2017-06-08T00:45:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![filebeater](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/filebeater/32/18565_2.png) [@filebeater](https://discuss.elastic.co/u/filebeater)\
**Post date:** [June 8, 2017, 12:45am UTC](https://discuss.elastic.co/t/exception-in-thread-main-worker4-java-lang-classcastexception-org-logstash-bivalues-stringbivalue-cannot-be-cast-to-java-lang-string-is-this-a-bug-in-logstash/88638/1 "2017-06-08T00:45:26Z")

</div>

hello,  
I consistently got an exception when running logstash. the exception is copied at the end. Any pointer is appreciated!  
Version: logstash-5.4.1  
Operating System: Redhat Enterprise R6.6(Santiago), i started a kafka server (version 0.10.0.20) in my local box, Config File:  
input {  
beats { port =\> "5043"}  
}  
output {  
stdout { codec =\> rubydebug }  
kafka {  
topic\_id =\> "graphlog"  
}

Sample Data:  
Before I added kafka output to the above config file, logstash ran file.  
After I added the kafka output to the logstash config file, I still got output to stdout and exception, but no output to kafka.

sample logstash output to stdout:  
{  
"host" =\> "yyu-XYZ",  
"source" =\> "myapp.out",  
"message" =\> "2017/06/06 18:29:20.974 WARN Bababa"  
}

Steps to Repro:

I encountered this exception upon the first log event from filebeat:  
Exception in thread "[main]\>worker4" java.lang.ClassCastException:  
org.logstash.bivalues.StringBiValue cannot be cast to java.lang.String  
at org.logstash.Event.toString(Event.java:312)  
at org.logstash.ext.JrubyEventExtLibrary$RubyEvent.ruby\_to\_s(JrubyEventExtLibrary.java:209)  
at  
org.logstash.ext.JrubyEventExtLibrary$RubyEvent$INVOKER$i$0$0$ruby\_to\_s.call(JrubyEventExtLibrary$RubyEvent$INVOKER$i$0$0$ruby\_to\_s.gen)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:134)  
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)  
at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.ast.IfNode.interpret(IfNode.java:118)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_METHOD(ASTInterpreter.java:74)  
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)  
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)  
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_METHOD(ASTInterpreter.java:74)  
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)  
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)  
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_BLOCK(ASTInterpreter.java:112)  
at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)  
at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)  
at org.jruby.runtime.Block.yield(Block.java:142)  
at org.jruby.RubyArray.eachCommon(RubyArray.java:1606)  
at org.jruby.RubyArray.each(RubyArray.java:1613)  
at org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)  
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:143)  
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)  
at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.ast.IfNode.interpret(IfNode.java:118)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_METHOD(ASTInterpreter.java:74)  
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)  
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)  
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_METHOD(ASTInterpreter.java:74)  
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)  
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)  
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)  
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)  
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)  
at org.jruby.evaluator.ASTInterpreter.INTERPRET\_METHOD(ASTInterpreter.java:74)  
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)  
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)  
at rubyjit.LogStash::Pipeline$$output\_batch\_75bfa3cb00ef46733d9a9d671234a933b6ebaa311118140819.block\_3$RUBY$file(/home/yyu/tools/logstash-5.4.1/logstash-core/lib/logstash/pipeline.rb:407)  
at rubyjit$LogStash::Pipeline$$output\_batch\_75bfa3cb00ef46733d9a9d671234a933b6ebaa311118140819$block\_3$RUBY$file.call(rubyjit$LogStash::Pipeline$$output\_batch\_75bfa3cb00ef46733d9a9d671234a933b6ebaa311118140819$block\_3$RUBY$file)  
at org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:135)  
at org.jruby.runtime.Block.yield(Block.java:142)  
at org.jruby.RubyHash$13.visit(RubyHash.java:1355)  
at org.jruby.RubyHash.visitLimited(RubyHash.java:648)  
at org.jruby.RubyHash.visitAll(RubyHash.java:634)  
at org.jruby.RubyHash.iteratorVisitAll(RubyHash.java:1306)  
at org.jruby.RubyHash.each\_pairCommon(RubyHash.java:1351)  
at org.jruby.RubyHash.each19(RubyHash.java:1342)  
at org.jruby.RubyHash$INVOKER$i$0$0$each19.call(RubyHash$INVOKER$i$0$0$each19.gen)  
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:143)  
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)  
at rubyjit.LogStash::Pipeline$$output\_batch\_75bfa3cb00ef46733d9a9d671234a933b6ebaa311118140819.file(/home/yyu/tools/logstash-5.4.1/logstash-core/lib/logstash/pipeline.rb:406)  
at rubyjit.LogStash::Pipeline$$output\_batch\_75bfa3cb00ef46733d9a9d671234a933b6ebaa311118140819.file(/home/yyu/tools/logstash-5.4.1/logstash-core/lib/logstash/pipeline.rb)  
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)  
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)

---

<div class="post-metadata">

**Author:** ![drmason13](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@drmason13](https://discuss.elastic.co/u/drmason13)\
**Post date:** [June 21, 2017, 9:18am UTC](https://discuss.elastic.co/t/exception-in-thread-main-worker4-java-lang-classcastexception-org-logstash-bivalues-stringbivalue-cannot-be-cast-to-java-lang-string-is-this-a-bug-in-logstash/88638/2 "2017-06-21T09:18:19Z")

</div>

Getting similar error. It appears to be related to: [https://github.com/elastic/logstash/issues/6756](https://github.com/elastic/logstash/issues/6756) and hasn't been fixed as of 16/06/2017.

I still don't understand what in our configs causes this, or whether there is any workaround.

It is caused by some internal code converting to strings incorrectly (apologies for the vagueness I'm not a java programmer.)

If anybody knows a workaround, please share it

---

<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:** [July 19, 2017, 9:18am UTC](https://discuss.elastic.co/t/exception-in-thread-main-worker4-java-lang-classcastexception-org-logstash-bivalues-stringbivalue-cannot-be-cast-to-java-lang-string-is-this-a-bug-in-logstash/88638/3 "2017-07-19T09:18:26Z")

</div>

Closed on July 19, 2017, 9:18am UTC

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