Fmriprep: error while executing mcflirt

Dear fMRIprep-experts,

I’m struggeling with the following error message and I do not understand why this error message is thrown in some sessions of some participants while fmriprep seems to be running fine for the same subjects in other sessions. Does anyone have a clue what is going here? I have compared the meta-information of the BIDS files with those sessions that works fine and I cold not spot any differences. I have also tried attributing more memory to fmriprep but this also did not help (also subjects were processed fine that had a bigger nifti file that there ones where the error was thrown). Here is the error output, any ideas are highly appreciated:

Node: fmriprep_wf.single_subject_481_wf.func_preproc_task_fMRIPA1_run_1_echo_1_wf.bold_hmc_wf.mcflirt
Working directory: /scratch/fmriprep_wf/single_subject_481_wf/func_preproc_task_fMRIPA1_run_1_echo_1_wf/bold_hmc_wf/mcflirt

Node inputs:

args =
bins =
cost =
dof =
environ = {‘FSLOUTPUTTYPE’: ‘NIFTI_GZ’}
in_file =
init =
interpolation =
mean_vol =
out_file =
output_type = NIFTI_GZ
ref_file =
ref_vol =
rotation =
save_mats = True
save_plots = True
save_rms = True
scaling =
smooth =
stages =
stats_imgs =
use_contour =
use_gradient =

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 67, in run_node
result[“result”] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 521, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 639, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 751, in _run_command
f"Exception raised while executing Node {self.name}.\n\n{result.runtime.traceback}"
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node mcflirt.

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 454, in aggregate_outputs
setattr(outputs, key, val)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/traits_extension.py”, line 330, in validate
value = super(File, self).validate(objekt, name, value, return_pathlike=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/traits_extension.py”, line 135, in validate
self.error(objekt, name, str(value))
File “/usr/local/miniconda/lib/python3.7/site-packages/traits/trait_handlers.py”, line 172, in error
value )
traits.trait_errors.TraitError: The ‘out_file’ trait of a MCFLIRTOutputSpec instance must be a pathlike object or string representing an existing file, but a value of ‘/scratch/fmriprep_wf/single_subject_481_wf/func_preproc_task_fMRIPA1_run_1_echo_1_wf/bold_hmc_wf/mcflirt/sub-481_task-fMRIPA1_run-1_echo-1_bold_mcf.nii.gz’ <class ‘str’> was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 401, in run
outputs = self.aggregate_outputs(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 461, in aggregate_outputs
raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory ‘/scratch/fmriprep_wf/single_subject_481_wf/func_preproc_task_fMRIPA1_run_1_echo_1_wf/bold_hmc_wf/mcflirt/sub-481_task-fMRIPA1_run-1_echo-1_bold_mcf.nii.gz’ for output ‘out_file’ of a MCFLIRT interface

It would help if you could provide the following information

  1. What version of fmriprep are you using?
  2. What command are you using to call fmriprep (including arguments)?
  3. Are your data BIDS valid?

Dear Steven,

thanks for answering so quickly.

  1. I am using: fMRIPrep-20.2.6

  2. for($i = 0; $i -lt $ID.length; $i++){ fmriprep-docker D:/data/fmri/bids E:/data/fmri/ participant --participant-label $ID[$i] --fs-license-file ‘C:/Users/studies/PVI/admin/freesurfer_license.txt’ --fs-no-reconall --ignore slicetiming --low-mem}
    I tried it with and without the --low-mem and --ignore slicetiming flag . It did not make a difference.

  3. For BIDS validation I used: https://bids-standard.github.io/bids-validator/ → no error was thrown for those subjects. Only warnings regarding scanning parameters (e.g.: The most common set of dimensions is: 104,104,72,1851 (voxels), This file has the dimensions: 104,104,72,1857 (voxels).) but the validator threw the same warning for every subject including the ones that worked fine with fmriprep.

Any idea?

best, maxi

Can you try updating to 20.2.7 or 21.0.1 and using a fresh working directory?

I get the same error. Data passed the BIDS validation. Do you guys know how to solve it? Thanks


Node: fmriprep_23_2_wf.sub_ID01_wf.bold_task_MFL_wf.bold_fit_wf.bold_hmc_wf.mcflirt
Working directory: /scratch/fmriprep_23_2_wf/sub_ID01_wf/bold_task_MFL_wf/bold_fit_wf/bold_hmc_wf/mcflirt

Node inputs:

args = <undefined>
bins = <undefined>
cost = <undefined>
dof = <undefined>
environ = {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
in_file = <undefined>
init = <undefined>
interpolation = <undefined>
mean_vol = <undefined>
out_file = <undefined>
output_type = NIFTI_GZ
ref_file = <undefined>
ref_vol = <undefined>
rotation = <undefined>
save_mats = True
save_plots = True
save_rms = True
scaling = <undefined>
smooth = <undefined>
stages = <undefined>
stats_imgs = <undefined>
use_contour = <undefined>
use_gradient = <undefined>

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node mcflirt.

Cmdline:
	mcflirt -in /data/sub-ID01/func/sub-ID01_task-MFL_bold.nii.gz -out /scratch/fmriprep_23_2_wf/sub_ID01_wf/bold_task_MFL_wf/bold_fit_wf/bold_hmc_wf/mcflirt/sub-ID01_task-MFL_bold_mcf.nii.gz -reffile /scratch/fmriprep_23_2_wf/sub_ID01_wf/bold_task_MFL_wf/bold_fit_wf/hmc_boldref_wf/gen_avg/sub-ID01_task-MFL_bold_average.nii.gz -mats -plots -rmsabs -rmsrel
Stdout:

Stderr:
	Killed
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 453, in aggregate_outputs
	    setattr(outputs, key, val)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
	    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
	    self.error(objekt, name, str(value))
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
	    raise TraitError(
	traits.trait_errors.TraitError: The 'out_file' trait of a MCFLIRTOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/scratch/fmriprep_23_2_wf/sub_ID01_wf/bold_task_MFL_wf/bold_fit_wf/bold_hmc_wf/mcflirt/sub-ID01_task-MFL_bold_mcf.nii.gz' <class 'str'> was specified.

	During handling of the above exception, another exception occurred:

	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 400, in run
	    outputs = self.aggregate_outputs(runtime)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 460, in aggregate_outputs
	    raise FileNotFoundError(msg)
	FileNotFoundError: No such file or directory '/scratch/fmriprep_23_2_wf/sub_ID01_wf/bold_task_MFL_wf/bold_fit_wf/bold_hmc_wf/mcflirt/sub-ID01_task-MFL_bold_mcf.nii.gz' for output 'out_file' of a MCFLIRT interface

Hi @hiuco and welcome to neurostars!

This implies your job ran out of memory. Upping the resources should help.

Best,
Steven