command not found: mem

You copied a line out of a pipeline log — that variable only exists inside the pipeline

why

Workflow managers set tool paths as environment variables ($BWA, $SAMTOOLS) that exist only while the workflow is running the task. Paste $BWA mem … into your own shell and the variable is empty, so the shell reads mem as the command name. This is a red herring — it tells you nothing about why the pipeline failed.

what to do

Ignore it and go back to the pipeline's own error. In Nextflow, open the Work dir: path printed just above the failure and read .command.err in full — the real reason is in there, usually before any long usage dump.

traced · read AMR++'s params.config and bwa.nf, Sep 2026
This is one entry from BioErrors, a catalogue of bioinformatics error messages that point at the wrong thing. Every entry was traced to its real cause before it was written down.
If your error is not in it, paste it there and it gets traced and added.