How to keep the pipeline going if error occurs at any step for any sample?

Nextflow provides a process directive called errorStrategy. You can read about it in the official documentation here.

The specific strategy that helps you in the situation you described is ignore. If tasks from a process with errorStrategy set to ignore fail, the pipeline will continue. You will still be informed that tasks failed, but the pipeline won’t be stopped because of it. See example below:

process DO_SOMETHING {
  errorStrategy 'ignore'

  input:
  path ifile

  output:
  path 'output_file'

  script:
  """
  do something
  """
}

Whatever process you have, simply add the errorStrategy 'ignore' at the beginning of the process, or in a config file, just like any other process directive.

You may also want to check the output of ignored tasks. I wrote a snippet about it here.