Freesurfer Error Using fMRIPrep

I am running fmriprep with the following command:

SINGULARITYENV_TEMPLATEFLOW_HOME=/home/fmriprep/.cache/templateflow singularity run 
--writable-tmpfs --cleanenv --containall -B /projects/b1108:/projects/b1108 
-B /projects/b1108/software/freesurfer_license/license.txt:/opt/freesurfer/license.txt 
-B /projects/b1108/templateflow:/home/fmriprep/.cache/templateflow 
participant --participant-label MWMH259 
-w /projects/b1108/studies/mwmh/data/processed/neuroimaging/work
--fs-license-file /opt/freesurfer/license.txt --output-spaces MNI152NLin6Asym --skull-strip-template OASIS30ANTs

I got the following error:

RuntimeError: Command:
recon-all -autorecon1 -noskullstrip -cw256 -hires -openmp 8 -subjid sub-MWMH259 -sd /projects/b1108/studies/mwmh/data/processed/neuroimaging/fmriprep/sourcedata/freesurfer -xopts-use -nomotioncor
mri_convert.bin: posixio.c:210: px_pgin: Assertion `*posp == ((off_t)(-1)) || *posp == lseek(nciop->fd, 0, 1)' failed.
/opt/freesurfer/bin/mri_convert: line 3:   502 Aborted                 (core dumped) mri_convert.bin "$@"
ERROR: converting to minc
Linux qnode0557 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux

recon-all -s sub-MWMH259 exited with ERRORS at Tue May 10 14:09:25 CDT 2022

I couldn’t find any reference to this error online. Any thoughts about what might have caused it?


The core dump could be due to not having read/write permissions to any relevant drives, or potentially a memory issue. How much memory/cpus are you devoting to the job?


I used 80G and one node. I thought that this might be a memory issue, so I upped it to 100G. Do you have a recommendation for memory/cpu allocations when running freesurfer with fmriprep?

Unless your images are super long or super high resolution, 80GB should be more than enough. What file is that error log coming from? And is that error subject specific, or reproducible across subjects?

Yes, I’ve seen the same error with other subjects. The 100G allocation got me to a new error that looks like this, though, so I guess it was a memory issue.

Some of our users had a similar issue.

This post in the FreeSurfer mailing list describes a potential fix.

In their case, the singularity.conf file should be located in the following path:


I spoke with my system administrator, and it seems like the issue boiled down to the number of CPUs/nodes I was requesting not matching what fmriprep tried to use internally. When I requested one CPU and one node, and explicitly stated that in the fmriprep call (e.g. --nprocs=1 --omp-nthreads=1), the run time for a single session was 34 hours, and utilized less than 9GB of memory, which seems very reasonable to me.