Using fsl.MotionOutliers in a nipype workflow when no outliers are detected

Does anyone have a solution for the usage case where we have the fsl.MotionOutliers as a node in a nipype workflow and no outliers are detected. In this case, no confound text-file gets created so passing the ‘out_file’ to the next step in the workflow throws an error.

Is there any way to force the generation of an empty file? Are there other ways?

I noticed that I hadn’t updated nipype on this machine in a while and it was seriously behind. Will give that a go first. Hopefully the solution is that easy.

It is not. The error message gets a little bit more informative though:

traits.trait_errors.TraitError: The 'out_file' trait of a MotionOutliersOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '<expected filename>' <class 'str'> was specified.

which results in:

FileNotFoundError: No such file or directory '<expected filename>' for output 'out_file' of a MotionOutliers interface

I guess this is expected behavior, but is there any way to make this work in a workflow?