nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Calling groupTuple triggers java.lang.NullPointerException

Open scwatts opened this issue 2 years ago • 1 comments

Bug report

Under certain conditions calling groupTuple appears to trigger a null pointer exception. A MRE is linked below. The process to trigger the null pointer exception in this MRE can be summarised as:

  • run process ONE and TWO
  • create a new channel named ch_three_input from ONE and TWO outputs
  • run process THREE with input from ch_three_input
  • take process THREE output and combine with ch_three_input using groupTuple

The final step that involves the groupTuple call triggers the exception. I don't think I'm using channels in an unintended way, so I suspect this behaviour is a bug.

Expected behavior and actual behavior

Calling groupTuple for process THREE output and ch_three_input should return a valid channel but instead causes a null pointer exception.

Steps to reproduce the problem

Please see the MRE here.

Program output

Error message produced in console:

Cannot invoke method add() on null object

Error message produced in .nextflow.log:

java.lang.NullPointerException: Cannot invoke method add() on null object

See the attached .nextflow.log file for more details.

Environment

  • Nextflow version 22.04.0 build 5697
  • openjdk 11.0.9.1 2020-11-04 LTS
  • macOS Catalina 10.15.7 (19H1824)
  • GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin19.6.0)

Also reproduced on Ubuntu, please see above linked GH repository containing MRE.

scwatts avatar Jun 07 '22 01:06 scwatts

This might be a lighter reproducible example:

workflow {
  ch_1 = Channel.of([1, '1a', '1b', '1c'], [2, '2a', '2b', '2c'])
  ch_2 = Channel.of([1, '1c', '1d'], [2, '2e', '2h'])

  ch_1 | mix(ch_2) | groupTuple | view
}

This example also conveniently provides a way to make the bug disappear:

workflow {
  ch_1 = Channel.of([1, '1a', '1b', '1c'], [2, '2a', '2b', '2c'])
  ch_2 = Channel.of([1, '1c', '1d'], [2, '2e', '2h'])

  ch_1 | mix(ch_2) | groupTuple() | view
  ch_1 | mix(ch_2)
}

robsyme avatar Sep 16 '22 19:09 robsyme

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] avatar Mar 18 '23 09:03 stale[bot]

Thanks @robsyme for including a testing example. Fixed by 1d32e2c2.

pditommaso avatar Mar 18 '23 17:03 pditommaso