Fix Neuroimaging Errors Fast with SpinLab’s Error Doctor
Neuroimaging software fails with messages that make sense only once you already know the answer. The SpinLab Error Doctor recognises around 50 common problems from tools such as HeuDiConv, dcm2niix, FSL and FreeSurfer. Paste the error, and it explains the cause and gives the corrected command.

Step by step
- Open spinlab.mrispin.com and choose Error Doctor.
- Paste the full error message, including the last lines of the traceback.
- Read the diagnosis: what went wrong and why.
- Copy the corrected command, and run the check command it suggests before running the fix on all your data.
Worked example: IsADirectoryError in HeuDiConv
A frequent first error with HeuDiConv is IsADirectoryError. It happens when the -d template points at a folder of folders, so HeuDiConv tries to open a directory as if it were a DICOM file.
# Fails: matches the subject folder itself
heudiconv -d '/data/dicom/{subject}' -s 01 -f heuristic.py -c dcm2niix -b -o /data/bids
# Works: match the files inside each series folder
heudiconv -d '/data/dicom/{subject}/*' -s 01 -f heuristic.py -c dcm2niix -b -o /data/bids
Before running the fix, check what the pattern really matches:
ls -d /data/dicom/01/* | head
If the output lists series folders rather than files, add another /* to the template so it reaches the DICOM files.
Other common errors and their usual causes
| Message (shortened) | Usual cause |
|---|---|
| FSLDIR not set / command not found | FSL’s setup script was not sourced in this shell |
| FreeSurfer license file not found | FS_LICENSE does not point at license.txt |
| No DICOMs found / empty output | The path or wildcard does not match the files |
| Permission denied | Output folder owned by another user, or a mounted drive is read-only |
# FSL environment (adjust the path to your installation)
export FSLDIR=/usr/local/fsl
source $FSLDIR/etc/fslconf/fsl.sh
# FreeSurfer license
export FS_LICENSE=$HOME/license.txt
Good habits
- Copy the whole error, not just the last line. The first lines often name the file that caused it.
- Test a fix on one subject before looping over all of them.
- Keep the command that worked in a script so the problem doesn’t come back.
Related: DICOM to BIDS with Autopilot and the HeuDiConv heuristic explained.
Last reviewed: 7 November 2026. SpinLab and SpinCalc are free tools developed by MRISpin. Screenshots show the tools as they were on this date and may change as the tools are updated. Generated scripts should be checked before use on real data.



