Description
When running the pipeline on AWS Batch (via Seqera Platform), the CELLPOSE process fails with Path value cannot be null even when segmentation is set to only use other segmenters (e.g., mccellpose).
The pipeline works correctly when run locally.
Steps to Reproduce
- Run the pipeline on AWS Batch with:
--segmentation mccellpose
- Do not set
--cellpose_model
Error
Feb-03 15:16:11.793 [Actor Thread 10] DEBUG nextflow.processor.TaskProcessor - Handling unexpected condition for
task: name=NFCORE_MCMICRO:MCMICRO:CELLPOSE (1); work-dir=null
error [nextflow.exception.ProcessUnrecoverableException]: Path value cannot be null
Root Cause
The workflow unconditionally pipes ch_segmentation_input to all segmentation processes (DEEPCELL_MESMER, CELLPOSE, MCCELLPOSE), relying on ext.when directives in conf/modules.config to skip execution:
// workflows/mcmicro.nf lines 141-148
ch_segmentation_input
.multiMap{ meta, image ->
image: [meta + [segmenter: 'cellpose'], image]
model: params.cellpose_model // defaults to [] in nextflow.config
}
| CELLPOSE
The ext.when conditions are correctly configured:
// conf/modules.config
ext.when = {params.segmentation && params.segmentation.split(',').contains('cellpose')}
However, AWS Batch executor validates and stages inputs before evaluating the when directive. Since params.cellpose_model defaults to [], the path validation fails before ext.when can skip the task.
This doesn't occur locally because the local executor handles path resolution more lazily.
Suggested Fix
Filter channels based on params.segmentation before piping to each process, rather than relying solely on ext.when:
if (params.segmentation?.split(',')?.contains('cellpose')) {
ch_segmentation_input
.multiMap{ meta, image ->
image: [meta + [segmenter: 'cellpose'], image]
model: params.cellpose_model
}
| CELLPOSE
ch_masks = ch_masks.mix(CELLPOSE.out.mask)
ch_versions = ch_versions.mix(CELLPOSE.out.versions)
}
This should be applied to all segmentation processes (DEEPCELL_MESMER, CELLPOSE, MCCELLPOSE).
Environment
- Nextflow version: 25.10.2
- Execution platform: AWS Batch via Seqera Platform
- Pipeline version: 2.0.0 (commit 044dcca)
Description
When running the pipeline on AWS Batch (via Seqera Platform), the CELLPOSE process fails with
Path value cannot be nulleven whensegmentationis set to only use other segmenters (e.g.,mccellpose).The pipeline works correctly when run locally.
Steps to Reproduce
--cellpose_modelError
Root Cause
The workflow unconditionally pipes
ch_segmentation_inputto all segmentation processes (DEEPCELL_MESMER, CELLPOSE, MCCELLPOSE), relying onext.whendirectives inconf/modules.configto skip execution:The
ext.whenconditions are correctly configured:However, AWS Batch executor validates and stages inputs before evaluating the
whendirective. Sinceparams.cellpose_modeldefaults to[], the path validation fails beforeext.whencan skip the task.This doesn't occur locally because the local executor handles path resolution more lazily.
Suggested Fix
Filter channels based on
params.segmentationbefore piping to each process, rather than relying solely onext.when:This should be applied to all segmentation processes (DEEPCELL_MESMER, CELLPOSE, MCCELLPOSE).
Environment