No such file or directory (in a task)

The file exists on your machine but was never staged into the task's working directory

why

Each task runs in its own isolated work directory containing only the files declared as inputs. A path that works when you run the command by hand will not resolve inside the task unless the workflow staged it there. Relative paths written inside a script are resolved against that work directory, not against where you launched from.

what to do

Declare the file as a proper input channel rather than hardcoding its path in the script. For reference data that must stay in place, pass an absolute path via a param, and remember that on a cluster or in a container that path also has to be mounted/visible on the compute node.

Nextflow / Snakemake execution model
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.