cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Error handling response - class java.lang.IllegalArgumentException for stdout in go blocks

Open eneroth opened this issue 3 years ago • 1 comments

Printing to stdout in go blocks results in an error:

Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

I'm using a socket REPL.

To reproduce:

;; With require [clojure.core.async :as async :refer [go <!]]


;; Timbre
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (timbre/info msg)
        (recur (<! test-ch)))
      (timbre/info "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

(async/close! test-ch)


;; Println
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (println msg)
        (recur (<! test-ch)))
      (println "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

(async/close! test-ch)

;; Tap
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (tap> msg)
        (recur (<! test-ch)))
      (tap> "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Works fine.
(async/close! test-ch)

eneroth avatar Oct 25 '21 09:10 eneroth

I ran into the same thing and fwiw I was able to solve it by just using nREPL instead of a normal socket REPL. This slack thread kind of explains what's going on in greater detail.

matthewdowney avatar Mar 14 '22 11:03 matthewdowney