nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.7k stars 621 forks source link

Missing `grab` dependency yields unhelpful error #3134

Open SamStudio8 opened 2 years ago

SamStudio8 commented 2 years ago

Bug report

Expected behavior and actual behavior

Expected A failed (or missing) @Grab in a user-provided Groovy script should stop Nextflow with a warning that could help the user actually diagnose the error. For example:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/Sam.Nicholls/scratch/groovy-tests/bad_grab/lib/BadGrab.groovy: 2: unable to resolve class groovyx.net.http.HttpBuilder
 @ line 2, column 1.
   import static groovyx.net.http.HttpBuilder.configure
   ^

Actual A failed (or missing) @Grab causes Nextflow to abort with:

BUG! exception in phase 'semantic analysis' in source unit 'Script_bac27a9e' The lookup for BadGrab caused a failed compilation. There should not have been any compilation from this call.

Steps to reproduce the problem

//@Grab('io.github.http-builder-ng:http-builder-ng-okhttp:0.14.2')
import static groovyx.net.http.HttpBuilder.configure

class BadGrab {
    public static String do_something() {
        return null
    }

    public static void main(String[] args)
    {
        System.out.println("Hoot hoot!")
    }
}

(Note the @Grab is intentionally commented out to simulate a forgotten or failed Grab)

Program output

N E X T F L O W  ~  version 22.04.3
Launching `bad_grab.nf` [chaotic_venter] DSL2 - revision: 59c165e8ea
BUG! exception in phase 'semantic analysis' in source unit 'Script_bac27a9e' The lookup for BadGrab caused a failed compilation. There should not have been any compilation from this call.

Environment

Additional context

I am sympathetic to how this particular case might be non-trivial for Nextflow to catch; however this sort of error should feed in to wider discussions about the usability of the language. The "... should not have been any compilation from this call" catch-all message is a particularly egregious example considering the emphasis on how "Nextflow can execute any piece of Groovy code", and yet offers no help in debugging code that uses Groovy.

SamStudio8 commented 2 years ago

In writing this report, I found that the "real" error for this issue can be found quite easily in the traceback sent to the .nextflow.log which makes it even more annoying that the error presented to the user is so unhelpful!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

subhashmahamkali commented 1 year ago

nextflow run main.nf -with-trace N E X T F L O W ~ version 0.25.1 Launching main.nf [compassionate_mcnulty] - revision: 02bf7220a3 ERROR ~ BUG! exception in phase 'semantic analysis' in source unit '_nf_script_47a7df0e' The lookup for WorkflowMain caused a failed compilaton. There should not have been any compilation from this call.

-- Check '.nextflow.log' file for details I have also got the simmilar error.. Any solution that you can recommend.

pditommaso commented 1 year ago

Version 0.25.1 was released five years ago! update it!

https://github.com/nextflow-io/nextflow/releases/tag/v0.25.1

subhashmahamkali commented 1 year ago

nextflow self-update NOTE: Nextflow is not tested with Java 1.8.0_332 -- It's recommended the use of version 11 up to 18

CAPSULE: Downloading dependency io.nextflow:nf-commons:jar:22.10.7 CAPSULE: Downloading dependency org.slf4j:jul-to-slf4j:jar:1.7.36 CAPSULE: Downloading dependency org.slf4j:jcl-over-slf4j:jar:1.7.36 CAPSULE: Downloading dependency commons-io:commons-io:jar:2.11.0 CAPSULE: Downloading dependency commons-codec:commons-codec:jar:1.15 CAPSULE: Downloading dependency com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava CAPSULE: Downloading dependency org.codehaus.groovy:groovy:jar:3.0.13 CAPSULE: Downloading dependency ch.grengine:grengine:jar:1.3.0 CAPSULE: Downloading dependency jline:jline:jar:2.9 CAPSULE: Downloading dependency ch.qos.logback:logback-core:jar:1.2.11 CAPSULE: Downloading dependency com.github.zafarkhaja:java-semver:jar:0.9.0 CAPSULE: Downloading dependency org.jsoup:jsoup:jar:1.14.3 CAPSULE: Downloading dependency org.yaml:snakeyaml:jar:1.30 CAPSULE: Downloading dependency org.codehaus.groovy:groovy-nio:jar:3.0.13 CAPSULE: Downloading dependency org.eclipse.jgit:org.eclipse.jgit:jar:6.2.0.202206071550-r CAPSULE: Downloading dependency com.google.code.findbugs:jsr305:jar:3.0.2 CAPSULE: Downloading dependency org.codehaus.groovy:groovy-templates:jar:3.0.13 CAPSULE: Downloading dependency org.iq80.leveldb:leveldb-api:jar:0.12 CAPSULE: Downloading dependency ch.qos.logback:logback-classic:jar:1.2.11 CAPSULE: Downloading dependency org.slf4j:log4j-over-slf4j:jar:1.7.36 CAPSULE: Downloading dependency com.google.guava:guava:jar:31.1-jre CAPSULE: Downloading dependency org.slf4j:slf4j-api:jar:1.7.36 CAPSULE: Downloading dependency org.codehaus.groovy:groovy-xml:jar:3.0.13 CAPSULE: Downloading dependency com.google.errorprone:error_prone_annotations:jar:2.11.0 CAPSULE: Downloading dependency io.nextflow:nf-httpfs:jar:22.10.7 CAPSULE: Downloading dependency dev.failsafe:failsafe:jar:3.1.0 CAPSULE: Downloading dependency com.google.j2objc:j2objc-annotations:jar:1.3 CAPSULE: Downloading dependency javax.activation:activation:jar:1.1.1 CAPSULE: Downloading dependency org.pf4j:pf4j:jar:3.4.1 CAPSULE: Downloading dependency org.iq80.leveldb:leveldb:jar:0.12 CAPSULE: Downloading dependency org.codehaus.groovy:groovy-json:jar:3.0.13 CAPSULE: Downloading dependency com.google.guava:failureaccess:jar:1.0.1 CAPSULE: Downloading dependency com.googlecode.javaewah:JavaEWAH:jar:1.1.13 CAPSULE: Downloading dependency com.google.code.gson:gson:jar:2.2.4 CAPSULE: Downloading dependency org.checkerframework:checker-qual:jar:3.12.0 CAPSULE: Downloading dependency io.nextflow:nextflow:jar:22.10.7 CAPSULE: Downloading dependency org.pf4j:pf4j-update:jar:2.3.0 Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/jgit/api/errors/GitAPIException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:757) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:419) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)

subhashmahamkali commented 1 year ago

nextflow -version

  N E X T F L O W
  version 21.10.6 build 5660
  created 21-12-2021 16:55 UTC (10:55 CDT)
  cite doi:10.1038/nbt.3820
  http://nextflow.io

extflow run tutorial.nf N E X T F L O W ~ version 21.10.6 Launching tutorial.nf [mad_venter] - revision: e61bd183fe [- ] process > splitLetters - No such variable: stdout

-- Check script 'tutorial.nf' at line: 16 or see '.nextflow.log' file for more details

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.