java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.

tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When multiple devices connect at the same time, my app crashes with an error

    Stack Overflow | 7 months ago | Swayam Prakash Agrawal
    java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.

    Root Cause Analysis

    1. rx.exceptions.OnErrorNotImplementedException

      No message provided

      at rx.Observable$27.onError()
    2. rxjava
      ReplaySubject.onError
      1. rx.Observable$27.onError(Observable.java:7923)
      2. rx.observers.SafeSubscriber._onError(SafeSubscriber.java:159)
      3. rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
      4. rx.internal.operators.NotificationLite.accept(NotificationLite.java:147)
      5. rx.internal.operators.CachedObservable$ReplayProducer.replay(CachedObservable.java:404)
      6. rx.internal.operators.CachedObservable$CacheState.dispatch(CachedObservable.java:220)
      7. rx.internal.operators.CachedObservable$CacheState.onError(CachedObservable.java:201)
      8. rx.internal.operators.CachedObservable$CacheState$1.onError(CachedObservable.java:175)
      9. rx.observers.Subscribers$5.onError(Subscribers.java:225)
      10. rx.observers.SafeSubscriber._onError(SafeSubscriber.java:159)
      11. rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
      12. rx.subjects.SubjectSubscriptionManager$SubjectObserver.onError(SubjectSubscriptionManager.java:227)
      13. rx.internal.operators.NotificationLite.accept(NotificationLite.java:147)
      14. rx.subjects.ReplaySubject$UnboundedReplayState.accept(ReplaySubject.java:465)
      15. rx.subjects.ReplaySubject$UnboundedReplayState.replayObserverFromIndex(ReplaySubject.java:514)
      16. rx.subjects.ReplaySubject$UnboundedReplayState.replayObserver(ReplaySubject.java:502)
      17. rx.subjects.ReplaySubject.caughtUp(ReplaySubject.java:427)
      18. rx.subjects.ReplaySubject.onError(ReplaySubject.java:387)
      18 frames
    3. com.polidea.rxandroidble
      RxBleRadioOperation$1.onError
      1. com.polidea.rxandroidble.internal.RxBleRadioOperation.onError(RxBleRadioOperation.java:84)
      2. com.polidea.rxandroidble.internal.RxBleRadioOperation$1.onError(RxBleRadioOperation.java:50)
      2 frames
    4. rxjava
      Observable.subscribe
      1. rx.observers.SafeSubscriber._onError(SafeSubscriber.java:159)
      2. rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
      3. rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:71)
      4. rx.observers.SafeSubscriber._onError(SafeSubscriber.java:159)
      5. rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
      6. rx.internal.operators.OperatorSingle$ParentSubscriber.onError(OperatorSingle.java:139)
      7. rx.internal.operators.OperatorTake$1.onError(OperatorTake.java:62)
      8. rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:240)
      9. rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:776)
      10. rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:537)
      11. rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:526)
      12. rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:810)
      13. rx.internal.operators.NotificationLite.accept(NotificationLite.java:147)
      14. rx.subjects.SubjectSubscriptionManager$SubjectObserver.accept(SubjectSubscriptionManager.java:318)
      15. rx.subjects.SubjectSubscriptionManager$SubjectObserver.emitLoop(SubjectSubscriptionManager.java:291)
      16. rx.subjects.SubjectSubscriptionManager$SubjectObserver.emitFirst(SubjectSubscriptionManager.java:270)
      17. rx.subjects.BehaviorSubject$1.call(BehaviorSubject.java:106)
      18. rx.subjects.BehaviorSubject$1.call(BehaviorSubject.java:102)
      19. rx.subjects.SubjectSubscriptionManager.add(SubjectSubscriptionManager.java:95)
      20. rx.subjects.SubjectSubscriptionManager.call(SubjectSubscriptionManager.java:60)
      21. rx.subjects.SubjectSubscriptionManager.call(SubjectSubscriptionManager.java:35)
      22. rx.Observable$2.call(Observable.java:162)
      23. rx.Observable$2.call(Observable.java:154)
      24. rx.Observable.unsafeSubscribe(Observable.java:8098)
      25. rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:232)
      26. rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:142)
      27. rx.internal.operators.OnSubscribeFromIterable$IterableProducer.fastpath(OnSubscribeFromIterable.java:127)
      28. rx.internal.operators.OnSubscribeFromIterable$IterableProducer.request(OnSubscribeFromIterable.java:70)
      29. rx.Subscriber.setProducer(Subscriber.java:211)
      30. rx.internal.operators.OnSubscribeFromIterable.call(OnSubscribeFromIterable.java:49)
      31. rx.internal.operators.OnSubscribeFromIterable.call(OnSubscribeFromIterable.java:32)
      32. rx.Observable$2.call(Observable.java:162)
      33. rx.Observable$2.call(Observable.java:154)
      34. rx.Observable$2.call(Observable.java:162)
      35. rx.Observable$2.call(Observable.java:154)
      36. rx.Observable$2.call(Observable.java:162)
      37. rx.Observable$2.call(Observable.java:154)
      38. rx.Observable.subscribe(Observable.java:8191)
      39. rx.Observable.subscribe(Observable.java:8158)
      39 frames
    5. com.polidea.rxandroidble
      RxBleRadioOperationServicesDiscover$$Lambda$1.call
      1. com.polidea.rxandroidble.internal.operations.RxBleRadioOperationServicesDiscover.lambda$run$71(RxBleRadioOperationServicesDiscover.java:34)
      2. com.polidea.rxandroidble.internal.operations.RxBleRadioOperationServicesDiscover.access$lambda$0(RxBleRadioOperationServicesDiscover.java)
      3. com.polidea.rxandroidble.internal.operations.RxBleRadioOperationServicesDiscover$$Lambda$1.call(Unknown Source)
      3 frames
    6. rxjava
      Observable.subscribe
      1. rx.Observable$2.call(Observable.java:162)
      2. rx.Observable$2.call(Observable.java:154)
      3. rx.Observable.subscribe(Observable.java:8191)
      4. rx.Observable.subscribe(Observable.java:8158)
      4 frames
    7. com.polidea.rxandroidble
      RxBleRadioImpl$$Lambda$4.call
      1. com.polidea.rxandroidble.internal.operations.RxBleRadioOperationServicesDiscover.run(RxBleRadioOperationServicesDiscover.java:44)
      2. com.polidea.rxandroidble.internal.radio.RxBleRadioImpl$$Lambda$4.call(Unknown Source)
      2 frames
    8. rxjava
      ScheduledAction.run
      1. rx.Observable$27.onNext(Observable.java:7928)
      2. rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139)
      3. rx.internal.util.ScalarSynchronousObservable$ScalarSynchronousAction.call(ScalarSynchronousObservable.java:115)
      4. rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
      4 frames
    9. Android Platform
      ActivityThread.main
      1. android.os.Handler.handleCallback(Handler.java:739)
      2. android.os.Handler.dispatchMessage(Handler.java:95)
      3. android.os.Looper.loop(Looper.java:135)
      4. android.app.ActivityThread.main(ActivityThread.java:5312)
      4 frames
    10. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    11. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
      2 frames