Cannot get property id on null object¶
Issue¶
Console
Execution aborted due to an unexpected error
-- Check script '/home/jfellows/Documents/git/nf-core/taxprofiler/./workflows/../modules/nf-core/modules/kraken2/kraken2/main.nf' at line: 2 or see '.nextflow.log' file for more details
Log
Possible source¶
In most cases meta.id does exist, it is just not accessible by Nextflow in the way it expects to.
- Input channels not correctly passed to a module
metatuple is incorrectly nested (e.g.[[<meta>]]vs.[<meta>])- Other parts of an input channel are incorrectly nested e.g.
[meta] [[reads1.fq, reads2.fq]]when should be[meta] [reads1.fq, reads2.fq]
- Two separate input channels both have a
meta.idtag (i.e., Nextflow doesn't know which one to take). - Can also occur when
meta.idtag is specified thetagblock of a module, butmetais not supplied as input.
Recommendation¶
Use static typing with Nextflow 26.10 or later, and declare the process input as a record or a typed tuple. nextflow lint then reports a wrongly nested meta map or reads list at the line where the process is called. It also reports meta used in a process that has no meta input, including in directives such as tag.
Without static typing, Nextflow 25.04 or later reports it in the output: and script: blocks, but not in directives.