sMRIPrep crashes at -autorecon1, but runs perfectly with --fs-no-reconall

The title is pretty informative. I’ve been trying to run sMRIPrep (basically the first half of fMRIPrep) on two subjects and it always crashes at the same place with the same error code for both subjects when I try to run the complete smriprep pipeline. Everything works perfectly when I put the flag --fs-no-reconall. I tried one subject alone and it does the same thing. Here is the error code:
“”"
File “/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py”, line 750, in _run_command
raise NodeExecutionError(
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node autorecon1.

RuntimeError: subprocess exited with code 1.
“”"

I checked the crash log .txt file but nothing looks weird to me. Here is the rest of the crash log .txt file:
“”"
Node inputs:

FLAIR_file =
T1_files = [’/data/sub-01/anat/sub-01_T1w.nii.gz’]
T2_file =
args =
big_ventricles =
brainstem =
directive = autorecon1
environ = {}
expert =
flags = [’-noskullstrip’]
hemi =
hippocampal_subfields_T1 =
hippocampal_subfields_T2 =
hires = True
mprage =
mri_aparc2aseg =
mri_ca_label =
mri_ca_normalize =
mri_ca_register =
mri_edit_wm_with_aseg =
mri_em_register =
mri_fill =
mri_mask =
mri_normalize =
mri_pretess =
mri_remove_neck =
mri_segment =
mri_segstats =
mri_tessellate =
mri_watershed =
mris_anatomical_stats =
mris_ca_label =
mris_fix_topology =
mris_inflate = -n 50
mris_make_surfaces =
mris_register =
mris_smooth =
mris_sphere =
mris_surf2vol =
mrisp_paint =
openmp = 8
parallel =
steps =
subject_id = sub-01
subjects_dir = /out/freesurfer
talairach =
use_FLAIR =
use_T2 =
xopts =
“”"

I’ve been looking online across several platforms to find a solution and haven’t found one yet after nearly a week.

I am using smriprep-docker 0.9.0 on Linux Ubuntu 18.04 if it matters.

@effigies @oesteban

Thank you in advance! :slight_smile:

Sorry, forgot to add that:

Just to add to my confusion, a freesurfer folder is created in the bids/derivatives/ folder with the typical freesurfer results subfolders (mri, scripts, surf, etc.). Moreover, the mri subfolder contains the expected output files from freesurfer (e.g., aseg.mgz, aparc+aseg.mgz, brain.mgz, etc.) but they seem to be calculated from an “unwanted” T1w template image (which is weird and not desired from me). I looked at these results in 3D Slicer and they look normal if you gave as input images the T1w template images…which is not the case as you can see from the crash log .txt that has the correct path to the mprage images (i.e., sub-01_T1w.nii.gz). I also verified in 3D Slicer and the sub-01_T1w.nii.gz is the correct mprage images I gave in input to smriprep-docker.

Seems likely related to Autorecon1 Crashing · Issue #2788 · nipreps/fmriprep · GitHub, but the utter lack of error messaging is a problem.

Thanks for verifying that it occurs in sMRIPrep. I will try to see if I can reproduce there; I’ve failed so far via fMRIPrep. Could you provide your full command?

I use a bash script based on fMRIPrep Tutorial #2: Running the Analysis — Andy's Brain Book 1.0 documentation. So, don’t mind the singularity part since I am not using it, only the docker (else).

Bash script:
“”"
#User inputs:
container=docker #docker or singularity [not implemented]
bids_root_dir=/home/marcantf/Data/bids_scaifield #[DATASET DEPENDENT]
subj=(01 02) #SUBJECT IDS [DATASET DEPENDENT]
nthreads=12
mem=54 #UPPER LIMIT ALLOCATED TO THE CALCULATION [GB]

#Begin:

#Convert virtual memory from gb to mb
mem=echo "${mem//[!0-9]/}" #remove gb at end
mem_mb=echo $(((mem*1000)-5000)) #reduce some memory for buffer space during pre-processing

export FS_LICENSE=/home/marcantf/Data/bids_scaifield/derivatives/license.txt #PATH TO THE FREESURFER LICENSE [REQUIRED TO USE FREESURFER]

#Run smriprep
if [ $container == singularity ]; then
unset PYTHONPATH; singularity run -B $HOME/.cache/templateflow:/opt/templateflow $HOME/smriprep.simg
$bids_root_dir $bids_root_dir/derivatives
participant
–participant-label $subj
–skip-bids-validation
–md-only-boilerplate
–fs-license-file $HOME/Desktop/Flanker/derivatives/license.txt
–fs-no-reconall
–output-spaces MNI152NLin2009cAsym:res-2
–nthreads $nthreads
–stop-on-first-crash
–mem_mb $mem_mb
-w $HOME
else
smriprep-docker $bids_root_dir $bids_root_dir/derivatives
participant
–fs-license-file $FS_LICENSE
–skull-strip-mode force
–verbose
–output-spaces fsnative
–mem-gb $mem_mb
-w $bids_root_dir/derivatives
fi
“”"
I then call “bash filename.sh” in the bids/code folder.

And yeah, it looks very similar to the issue you sent.