Fmriprep autorecon31 error using Docker

Hi everyone,

Very new to fmriprep and fmri so apologies if I miss any details.

I have just run fmriprep 1.4.1 using Docker on my Windows computer (also using fs and aroma) and up until this point it was running fine with no errors but I’ve just run a participant and come across a autorecon31 error in the html file. I had a browse on the forum and accordingly looked for an inactive version of freesurfer in my .bashrc file but was not able to find this.

Does anyone have any other ideas as to why this is happening or what I can do to resolve this error?

Many thanks in advance!

Hi @aysham,

Can you provide your full command, and any details of your error? If it’s this issue, it may be that rerunning will resolve it.


Hi Chris,

Thanks for responding! The command I put in was

fmriprep-docker C:\Users\am\Documents\fMRIExp\Pre-Processing\bids C:\Users\am\Documents\fMRIExp\fmriprep2 --fs-license-file C:\Users\am\Documents\license.txt --participant-label en04a --use-aroma

and the error was this:

I’m now re-running it for the 3rd time but the error has consistently come up the last two times so my guess is it likely to come up again (but maybe I’ll get lucky!)

Thank you again,

You should be able to find more details of the error in C:\Users\am\Documents\fMRIExp\fmriprep2\freesurfer\sub-en04a\scripts\recon-all.log.

So at the bottom of the file it writes:

Started at Mon Aug 19 20:05:57 UTC 2019
Ended at Mon Aug 19 20:39:01 UTC 2019
#@#%# recon-all-run-time-hours 0.551
recon-all -s sub-en04a finished without error at Mon Aug 19 20:39:02 UTC 2019

And no other errors pop up in the log file but it does in the html. I have just checked the other run and the log file states the same (pasted below)

Started at Tue Aug 20 02:51:33 UTC 2019
Ended at Tue Aug 20 03:24:48 UTC 2019
#@#%# recon-all-run-time-hours 0.554
recon-all -s sub-en04a finished without error at Tue Aug 20 03:24:48 UTC 2019

Any idea what might be causing this?

Many thanks again,

Hmm. Well, perhaps there’s a recon-all-lh.log (or similar) and another one for rh. Those might have the information you’re looking for.

Hi everyone,

I got the similar error but on the _auotorecon_surfs0 and _autorecon_surfs1 steps when I running fmriprep using Docker on Ubuntu system on single subject.

Here’s the command that I used:
sudo docker run -ti --rm -v /home/ghep/data/SAM/Nifti:/data:ro -v /home/ghep/qiny/SAM/fmriprep_out:/out -v /home/ghep/qiny/freesurfer/license.txt:/opt/freesurfer/license.txt -v /home/ghep/qiny/SAM/tmp:/tmp:rw nipreps/fmriprep:latest /data /out/out participant -w /tmp --skip_bids_validation --participant-label 001

But it got error on _autorecon_surfs0 and _autorecon_surfs1 steps. I checked “[recon-all.log](file:///home/ghep/qiny/SAM/fmriprep_out/out/fmriprep/sub-001.html)” file, but cannot find what’s the reason cause this error.

Does anyone have any solution for this issue? Many thanks!


Hi Qinyuan, I would start by looking at the contents of your FreeSurfer directory. Check that mri/T1.mgz looks reasonable, as well as mri/brain.mgz. If the skull-stripping went poorly, FreeSurfer is likely to fail badly.

If those look good, perhaps you can upload your recon-all.log files?

Hi Chris,

Thanks for your reply! It’s really strange because when I rerun fMRIPrep pipeline three times again, the whole pipeline finished without reporting any error in this subject.

But when I run fMRIPrep on other subject (sub-05), the error happens again. So I follow your suggestion to check the mri/T1.mgz and mri/brain.mgz. I think both of them look good (see as below).

Attached please find the recon-all.log, recon-all-rh.log, recon-all-lh.log.

recon-all.txt (140.4 KB)

recon-all-rh.log.txt (52.3 KB)

recon-all-lh.log.txt (88.7 KB)

Should I just rerun the program several times? Or there have other solution to figure out this issue? Many thanks!


Hi Chris,

I think I might find a solution to figure out my issue. Please feel free to correct me if I were wrong.

I add “–n-cpus 6” and “–nthreads 2” options to maximum number of threads across all processes, and try to run 3 subjects together (e.g. “–participant-label 01 03 05”). The fMRIPrep pipeline finished successfully and did not report any error.

So I think if recon-all can not run successfully in this step, maybe we can try to allocate calculation resources of our PC using “–n-cpus” and “–nthreads” options?


Ah, if that’s the case, then your error was very likely an out-of-memory error. Typically these exhibit differently in fMRIPrep. We have a somewhat longstanding issue of needing to accurately calculate the amount of memory each job takes, and we’re hoping to collect a lot of data in the coming months to achieve this.

IIRC FreeSurfer aims to keep memory usage under 2GB at all times. Given that we run two copies of FreeSurfer in parallel for any subject, then if FreeSurfer is consuming all cores, then it should not use more than 4GB + some overhead from fMRIPrep. It may be that running multiple participants allowed FreeSurfer to consume more RAM than you had available, or it may be that other jobs running at the same time consumed RAM that should have been available to FreeSurfer.

I don’t have an actionable takeaway here, and it sounds like you’ve got at least something working. Please let me know if you still have a question.

I apologize for not getting back to you sooner. I would like to say that I’m unusually snowed in with tasks at the moment, but it does not feel very unusual at this point…