Pattern debug for connection section (or extension section) fails, if in Identification section, a library reference step is configured with preconditionDescriptionThere is no issue running Discovery or debugging the identification section.However debugging connection section fails with error: "Steps were not executed in MID: Please refer to MID Server log".In Agent log, it says:2022-03-03 17:25:03 (975) Worker-Interactive:PatternDebuggerProbe-5815afb01b82c5904e7ca7da274bcb86 SEVERE *** ERROR *** (28)AbstractPatternExecutor - class com.snc.sw.kb.lang.closure.IfClosure cannot be cast to class com.snc.sw.kb.lang.closure.LibraryReferenceClosure (com.snc.sw.kb.lang.closure.IfClosure and com.snc.sw.kb.lang.closure.LibraryReferenceClosure are in unnamed module of loader 'app')java.lang.ClassCastException: class com.snc.sw.kb.lang.closure.IfClosure cannot be cast to class com.snc.sw.kb.lang.closure.LibraryReferenceClosure (com.snc.sw.kb.lang.closure.IfClosure and com.snc.sw.kb.lang.closure.LibraryReferenceClosure are in unnamed module of loader 'app')at com.snc.sw.pattern.AbstractPatternExecutor.expandNonConditionalLibrary(AbstractPatternExecutor.java:714)at com.snc.sw.pattern.DebuggerPatternExecutor.recursiveExpandLibraries(DebuggerPatternExecutor.java:68)at com.snc.sw.pattern.DebuggerPatternExecutor.extractStepsFromIdentification(DebuggerPatternExecutor.java:52)at com.snc.sw.pattern.AbstractPatternExecutor.executeIdentification(AbstractPatternExecutor.java:319)at com.snc.sw.pattern.AbstractPatternExecutor.executeIdentifications(AbstractPatternExecutor.java:579)at com.service_now.mid.probe.PatternDebuggerProbe.handleTask(PatternDebuggerProbe.java:174)at com.service_now.mid.probe.PatternDebuggerProbe.runProbe(PatternDebuggerProbe.java:119)at com.service_now.mid.probe.ServiceWatchProbe.probe(ServiceWatchProbe.java:35)at com.service_now.mid.probe.AProbe.process(AProbe.java:106)at com.service_now.mid.queue_worker.AWorker.runWorker(AWorker.java:129)at com.service_now.mid.queue_worker.AWorkerThread.run(AWorkerThread.java:20)at com.service_now.mid.threadpool.ResourceUserQueue$RunnableProxy.run(ResourceUserQueue.java:649)at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)at java.base/java.lang.Thread.run(Thread.java:834)Steps to Reproduce > open Windows OS - Server pattern, identification section> on step 1 DNS, which is a library reference, create precondition "1" Equals "1"> now debug extension section "Collect MSSQL Info", same error show up: Steps were not executed in MID: Please refer to MID Server log> check agent log, it shows java error - AbstractPatternExecutor - IfClosure cannot be cast to class com.snc.sw.kb.lang.closure.LibraryReferenceClosureWorkaroundWorkaround is to remove the precondition off the library step, and add the precondition to each individual step included in the library.Related Problem: PRB1561717