data-science

Ludger Solbach 2025-08-25T18:49:45.050189Z

Hello Clay developers, in the case of an error generating a notebook with clay/make, would it be possible to report the line of the notebook where error is occurring? The stacktrace does not show any information about the offending line of the notebook.

Execution error (AssertionError) at org.soulspace.qclojure.domain.circuit/circuit-depth (circuit.clj:1378).
Assert failed: (s/valid? :org.soulspace.qclojure.domain.circuit/quantum-circuit circuit)
scicloj.clay.v2.make/clay-render-notebook (make.clj:392)
scicloj.clay.v2.make/clay-render-notebook (make.clj:355)
scicloj.clay.v2.make/handle-single-source-spec! (make.clj:435)
scicloj.clay.v2.make/handle-single-source-spec! (make.clj:408)
clojure.core/mapv (core.clj:7059)
clojure.lang.ArrayChunk/reduce (ArrayChunk.java:60)
clojure.core.protocols/fn (protocols.clj:135)
clojure.core.protocols/fn (protocols.clj:123)
clojure.core.protocols/fn (protocols.clj:19)
clojure.core.protocols/seq-reduce (protocols.clj:31)
clojure.core.protocols/fn (protocols.clj:74)
clojure.core.protocols/fn (protocols.clj:13)
clojure.core/reduce (core.clj:6965)
clojure.core/mapv (core.clj:7050)
scicloj.clay.v2.make/make! (make.clj:483)
scicloj.clay.v2.make/make! (make.clj:471)
scicloj.clay.v2.api/make! (api.clj:35)
scicloj.clay.v2.api/make! (api.clj:34)
dev/eval45447 (NO_SOURCE_FILE:7)
clojure.lang.Compiler/eval (Compiler.java:7739)
nrepl.middleware.interruptible-eval/evaluator (interruptible_eval.clj:106)
nrepl.middleware.interruptible-eval/evaluator (interruptible_eval.clj:101)
nrepl.middleware.session/session-exec (session.clj:230)
nrepl.SessionThread/run (SessionThread.java:21)
The notebook has 1500+ lines, so single stepping through every line of code is a bit cumbersome.

Daniel Slutsky 2025-08-25T18:52:05.948299Z

Hi Ludger, thanks for looking into this. It is helpful to know about anything that could be made more convenient. I see circuit.clj:1378 at the beginning. Is it not the line?

Ludger Solbach 2025-08-25T18:53:17.792019Z

Oh, the generated html output shows the location of the error. That's good. But some context with the exception would be helpful nevertheless.

Ludger Solbach 2025-08-25T18:55:10.008319Z

The circuit.clj:1378 is the line, where the assertion failed, but not the line of the notebook that triggered the code. As the code is executed by clay and not by the notebook, the context of the notebook is not in the stacktrace.

Daniel Slutsky 2025-08-25T18:55:45.708949Z

I see, thanks.

Daniel Slutsky 2025-08-25T18:57:54.670209Z

Recently there have been some changes in exception reporting in the Clay browser view, by the way. So different versions behave differently. For reference, changes have been discussed recently here (requires Zulip login): https://clojurians.zulipchat.com/#narrow/channel/422115-clay-dev/topic/PR.20254.20-.20exception.20handling/ Anyway, I'll look into the behaviour you described. Probably not today.

Ludger Solbach 2025-08-25T20:35:24.662989Z

I'm using 2-beta52 and the report in the browser is fine. But I wasn't looking at the browser because I thought the generation had failed and the browser was on a different workspace.

Daniel Slutsky 2025-08-25T20:38:25.146869Z

thanks