Is there a way to make custom/additional messages for resource exceeded errors?

A common issue reported by various users of various nf-core pipelines is when their particular pipeline run hits a default resource limit (in most cases: the time setting).

Unfortunately many users don’t understand what this is referring to or how to modify this variable because they often interact with parameters on the pipeline using CLI flags, and thus do not come across config files.

Normally when we get a GitHub issue or slack message, we have to send the user to nf-core or nextflow docs pages ‘manually’. But this feels inefficient for a common and easily solved issue.

I’ve just realised that when a process limit is reached, a particular error message is provided:

ERROR ~ Error executing process > 'NFCORE_MAG:MAG:BINNING_PREPARATION:BOWTIE2_ASSEMBLY_ALIGN (MEGAHIT-xyz)'

Caused by:
Process exceeded running time limit (8h)

I was wondering whether it is possible at the script level, whether a developer could pick up this error with a specific e.g. Exit-Code like variable, and somehow print a message telling the user to check the relevant nf-core/nextflow pages? Whether by extending the message above, or printing at the end of the (failed) pipeline execution.

1 Like

You could try to parse ${workflow.errorReport}. See the example below:


workflow {
  FOO()
}

workflow.onError {
  if (workflow.errorReport.contains("Process requirement exceeds available memory")) {
    println "🛑 You sure you have this much RAM memory? 😅"
  }
}

Output:

Aha genius! I didn’t know about errorReport!! This would be perfect thank you @mribeirodantas !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.