malli 2025-10-24

I have a project in which many of the functions are of the form (fn[ctx arg] ...) where ctx is a big ball of state that I have no control over and arg is the thing I want to validate. My code will generally follow this pattern when instrumented:

(require '[malli.instrument :as mi])
  (mi/instrument!)
  ;; (mi/unstrument!)
  (m/function-schemas)

  ;; Defined elsewhere
  (m/=> my-fn specs/my-fn)
  
  (my-fn ctx {:arg-1 "1" :arg-2 "2"})
The challenge is that when schema validation fails, I get the error:
Execution error (StackOverflowError) at cider.nrepl.print-method/eval79059$fn (print_method.clj:39).
null
This is due to the complexity of ctx. IDK if there's a recursive relationship in the data or it's just supermassive. Either way, what I want to do is define my context spec as any? or map? and then exclude it from the output when failures are being printed. Is there a way to do this?

I think I need to redefine the print-method on the object, which is not a malli thing.

Do you know what cider is printing? I wonder if it's the ex-data thrown by malli that includes the arguments. In that case, you probably want to redefine the print-method, yes.

Even if ctx is any? it will still print if e.g., :arg-1 is wrong.

Yeah, once I realized the real issue, I posted the actual problem I'm trying to solve here https://clojurians.slack.com/archives/C03S1KBA2/p1761325378795719.

👍 2