fMRIPrep BET segmentation fault

Summary of what happened:

I am preprocessing structural (T1 + T2) and functional (BOLD rs-fMRI) data of 10 different subjects at once, and I am getting that fMRIPrep failed and 5 different errors were encountered.

Command used (and if a helper script was used, a link to the helper script or the command generated):

fmriprep \
  /home/jovyan/Desktop/DatasetOASIS3/raw \
  /home/jovyan/Desktop/DatasetOASIS3/derivative \
  participant \
  --participant-label OAS30001 OAS30002 OAS30003 OAS30004 OAS30005 OAS30006 OAS30007 OAS30008 OAS30009 OAS30010 \
  --n-cpus 6 \
  --mem-mb 12000 \
  --output-spaces MNI152NLin2009cAsym:res-2 \
  --bold2anat-init t2w \
  --random-seed 34 \
  --cifti-output 91k \
  --fs-license-file /home/jovyan/Desktop/PBL_Neuro/Freesurfer/license.txt \
  --work-dir /tmp/fmriprep_work \
  --notrack

Version:

fmriprep 25.1.3

Environment (Docker, Singularity / Apptainer, custom installation):

Neurodesktop

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

fMRIPrep failed: 5 raised. Re-raising first.
RuntimeError: Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.12/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.12/site-packages/nipype/pipeline/engine/nodes.py", line 525, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/nodes.py", line 643, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/nodes.py", line 769, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node skullstrip_first_pass.

Cmdline:
	bet sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
Stdout:
	/opt/conda/envs/fmriprep/bin/bet failed during command:sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
Stderr:
	/opt/conda/envs/fmriprep/bin/bet: line 399: 176083 Segmentation fault      (core dumped) ${FSLDIR}/bin/bet2 $IN $OUT $bet2opts
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 401, in run
	    runtime = self._run_interface(runtime)
	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/fsl/preprocess.py", line 165, in _run_interface
	    self.raise_exception(runtime)
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 689, in raise_exception
	    raise RuntimeError(
	RuntimeError: Command:
	bet sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
	Standard output:
	/opt/conda/envs/fmriprep/bin/bet failed during command:sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
	Standard error:
	/opt/conda/envs/fmriprep/bin/bet: line 399: 176083 Segmentation fault      (core dumped) ${FSLDIR}/bin/bet2 $IN $OUT $bet2opts
	Return code: 1



The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/run.py", line 142, in main
    fmriprep_wf.run(**config.nipype.get_plugin())
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/workflows.py", line 625, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/plugins/base.py", line 223, in run
    raise error from cause
RuntimeError: 5 raised. Re-raising first.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/bin/fmriprep", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/run.py", line 215, in main
    failed_reports = generate_reports(
                     ^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/reports/core.py", line 103, in generate_reports
    report_error = run_reports(
                   ^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/reports/core.py", line 43, in run_reports
    robj = Report(
           ^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nireports/assembler/report.py", line 292, in __init__
    line = line.format(**meta_repl)
           ^^^^^^^^^^^^^^^^^^^^^^^^

Screenshots / relevant information:


Hi @Ibai_Azpeitia_Loiti,

In the future, please use a more informative title and format your code text as code by surrounding it in tick marks or using the </> button in the text editor. You can see I have made these changes for you this time.

Are you using a container to run fMRIPrep? Containers are recommended.

12 GB is not a lot of memory, especially for 10 subjects.

It also looks like your traceback was cut off towards the end, was the more in the error log?

Best,
Steven

Hi @Steven,

I am using fmriprep within NeuroDesktop, but not with a container I’d say. I have increased the memory limit, but I keep getting the same error.

How much memory? Does the error persist with one subject and a clean work dir? What is the full error traceback?

I’ve increased the memory to 120.000 mb. I will now try to perform the analysis with a singe subject and a clean work directory.

I attach the full error traceback:

fMRIPrep failed: 5 raised. Re-raising first.
RuntimeError: Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.12/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.12/site-packages/nipype/pipeline/engine/nodes.py", line 525, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/nodes.py", line 643, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/nodes.py", line 769, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node skullstrip_first_pass.

Cmdline:
	bet sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
Stdout:
	/opt/conda/envs/fmriprep/bin/bet failed during command:sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
Stderr:
	/opt/conda/envs/fmriprep/bin/bet: line 399: 97577 Segmentation fault      (core dumped) ${FSLDIR}/bin/bet2 $IN $OUT $bet2opts
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 401, in run
	    runtime = self._run_interface(runtime)
	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/fsl/preprocess.py", line 165, in _run_interface
	    self.raise_exception(runtime)
	  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 689, in raise_exception
	    raise RuntimeError(
	RuntimeError: Command:
	bet sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
	Standard output:
	/opt/conda/envs/fmriprep/bin/bet failed during command:sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref.nii.gz sub-OAS30001_ses-2_task-rest_run-01_desc-coreg_boldref_brain.nii.gz -f 0.20 -m
	Standard error:
	/opt/conda/envs/fmriprep/bin/bet: line 399: 97577 Segmentation fault      (core dumped) ${FSLDIR}/bin/bet2 $IN $OUT $bet2opts
	Return code: 1



The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/run.py", line 142, in main
    fmriprep_wf.run(**config.nipype.get_plugin())
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/engine/workflows.py", line 625, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nipype/pipeline/plugins/base.py", line 223, in run
    raise error from cause
RuntimeError: 5 raised. Re-raising first.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/bin/fmriprep", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/run.py", line 215, in main
    failed_reports = generate_reports(
                     ^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/reports/core.py", line 103, in generate_reports
    report_error = run_reports(
                   ^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/fmriprep/reports/core.py", line 43, in run_reports
    robj = Report(
           ^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.12/site-packages/nireports/assembler/report.py", line 292, in __init__
    line = line.format(**meta_repl)
           ^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'session'