TraitError in fMRIPrep 25.2.5

Summary of what happened:

I just made a long awaited upgrade from 1.4.1 to the current version (25.2.5) and of course ran into trouble. I tried to run a job that was successfully run with 1.4.1 (same BIDS dataset, same server) but with the new version I keep getting a TraitError about the “input_image” trait (see below). I guess it can’t find some images but I don’t know which one and why. I have cleared the ‘‘work” folder as well.

Any tips will be appreciated! Thank you in advance!

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

fmriprep \
../bids_datasets \
../output_fmriprep25.2.5_test \
participant \
-v \
--output-spaces MNI152NLin2009cAsym:res-2 \
-w ../bids_datasets/work/ \
--nprocs 4 \
--fs-no-reconall \
--fs-license-file ./license.txt \
--mem 128000 \
--participant-label ARE

Version:

25.2.5

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

Singularity

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

1: [WARN] You should define ‘SliceTiming’ for this file. If you don’t provide this information slice time correction will not be possible. ‘Slice Timing’ is the time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order – rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition. (code: 13 - SLICE_TIMING_NOT_DEFINED)

./sub-ARE/ses-01/func/sub-ARE_ses-01_task-rest_acq-TR2500_run-1_bold.nii.gz

Please visit https://neurostars.org/search?q=SLICE_TIMING_NOT_DEFINED for existing conversations about this issue.

2: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

3: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

Please visit https://neurostars.org/search?q=TOO_FEW_AUTHORS for existing conversations about this issue.

Summary:                Available Tasks:        Available Modalities:

85 Files, 1.57GB        rest                    MRI

21 - Subjects

1 - Session

If you have any questions, please post on https://neurostars.org/tags/bids .

Relevant log outputs (up to 20 lines):

PASTE LOG OUTPUT HERE
260512-10:19:52,785 nipype.workflow IMPORTANT:
	 Building fMRIPrep's workflow:
           * BIDS dataset path: /scratch4/brapp1/WORDLLI/scripts/../bids_datasets_old/a1/nifti.
           * Participants and sessions: sub-ARE ses-01.
           * Run identifier: 20260512-101934_a4235daa-7a1f-4b9c-bfcd-c4b77f18f293.
           * Output spaces: MNI152NLin2009cAsym:res-2.
           * Pre-run FreeSurfer's SUBJECTS_DIR: /scratch4/brapp1/WORDLLI/scripts/../output_fmriprep25.2.5_test/sourcedata/freesurfer.
260512-10:19:53,762 nipype.workflow INFO:
	 ANAT Stage 1: Adding template workflow
260512-10:19:54,132 nipype.workflow INFO:
	 ANAT Stage 2: Preparing brain extraction workflow
260512-10:19:54,216 nipype.workflow INFO:
	 ANAT Stage 3: Preparing segmentation workflow
260512-10:19:54,219 nipype.workflow INFO:
	 ANAT Stage 4: Preparing normalization workflow for ['MNI152NLin2009cAsym']
260512-10:19:54,227 nipype.workflow INFO:
	 ANAT Skipping Stages 5+
260512-10:19:54,474 nipype.workflow INFO:
	 No single-band-reference found for sub-ARE_ses-01_task-rest_acq-TR2500_run-1_bold.nii.gz.
260512-10:19:54,536 nipype.workflow INFO:
	 Stage 1: Adding HMC boldref workflow
260512-10:19:54,544 nipype.workflow INFO:
	 Stage 2: Adding motion correction workflow
260512-10:19:54,550 nipype.workflow INFO:
	 No fieldmap correction - skipping Stage 3
260512-10:19:54,550 nipype.workflow INFO:
	 Stage 4: Adding coregistration boldref workflow
Process Process-2:
Traceback (most recent call last):
  File "/app/.pixi/envs/fmriprep/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/app/.pixi/envs/fmriprep/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/workflow.py", line 116, in build_workflow
    retval['workflow'] = init_fmriprep_wf()
                         ^^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/base.py", line 108, in init_fmriprep_wf
    single_subject_wf = init_single_subject_wf(subject_id, sessions, name=wf_name)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/base.py", line 875, in init_single_subject_wf
    bold_wf = init_bold_wf(
              ^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/bold/base.py", line 248, in init_bold_wf
    bold_fit_wf = init_bold_fit_wf(
                  ^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/bold/fit.py", line 561, in init_bold_fit_wf
    enhance_boldref_wf = init_enhance_and_skullstrip_bold_wf(omp_nthreads=omp_nthreads)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/niworkflows/func/util.py", line 453, in init_enhance_and_skullstrip_bold_wf
    ApplyTransforms(
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/ants/base.py", line 76, in __init__
    super().__init__(**inputs)
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 633, in __init__
    super().__init__(**inputs)
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py", line 204, in __init__
    self.inputs.trait_set(**inputs)
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/traits/has_traits.py", line 1458, in trait_set
    setattr(self, name, value)
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/traits_extension.py", line 325, in validate
    value = super().validate(objekt, name, value, return_pathlike=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
    self.error(objekt, name, str(value))
  File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: The 'input_image' trait of a _FixTraitApplyTransformsInputSpec instance must be a pathlike object or string representing an existing file, but a value of '[]' <class 'str'> was specified.

Screenshots / relevant information:


Hi @Yuan_Tao,

Please provide the output of the BIDS validator. May you also provide the exact Singularity command you ran (with the singularity run preamble)? Also, unrelated but --fs-no-reconall is not recommended.

Best,

Steven

Thanks Steven for your prompt reply.
I am not sure how to paste the BIDS validator as text. I did get a long list of warning messages about missing recommended keys, but nothing catastrophic and I have run the older version of fmriprep with the same dataset in the past.

I do have the following output that may be relevant (also added into original post)?


1: [WARN] You should define ‘SliceTiming’ for this file. If you don’t provide this information slice time correction will not be possible. ‘Slice Timing’ is the time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order – rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition. (code: 13 - SLICE_TIMING_NOT_DEFINED)

./sub-ARE/ses-01/func/sub-ARE_ses-01_task-rest_acq-TR2500_run-1_bold.nii.gz

Please visit https://neurostars.org/search?q=SLICE_TIMING_NOT_DEFINED for existing conversations about this issue.

2: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

3: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

Please visit https://neurostars.org/search?q=TOO_FEW_AUTHORS for existing conversations about this issue.

Summary:                Available Tasks:        Available Modalities:

85 Files, 1.57GB        rest                    MRI

21 - Subjects

1 - Session

If you have any questions, please post on https://neurostars.org/tags/bids .

Re Singularity, the command is

singularity exec ~/fmriprep-25.2.5.simg sh ~/scripts/runFmripre.sh

Not sure what the difference is between exec and run, but again that’s the same script we’ve been using on the same server.

And would you elaborate why skipping the FS recon is not recommended? It takes a long time and we have FS processing done elsewhere outside the resting-state fMRI analysis. That’s why I skip it here to save resources.

Hi @Yuan_Tao,

Because it skips surface processing steps that are helpful (such as boundary based registration).

You still don’t want to add the --fs-no-reconall flag. You need to pass in your precomputed FS derivatives with the --fs-subjects-dir argument.

What are the contents of this script?

This is a pretty irregular way to use fmriprep. Mostly the command is like:

singularity run \
  -e \
  --writable-tmpfs \
  -B ${ANY_IMPORTANT_FOLDERS_YOU_NEED} \
  ${FMRIPREP_CONTAINER} \
  ${FMRIPREP_ARGS}

so for you,

FMRIPREP_CONTAINER=/path/to/your/fmriprep_container.sif
BIDS=/path/to/bids_datasets/
OUT=/path/to/derivatives/
WORK=/path/to/work/
LICENSE=/path/to/license.txt
FREESURFER_SUBJECTS_DIR=/path/to/freesurfer_outputs/

singularity run \
  -e \
  --writable-tmpfs \
  -B ${BIDS}:/bids:ro \
  -B ${OUT}:/out \
  -B ${WORK}:/work \
  -B ${LICENSE}:/license.txt \
  -B ${FREESURFER_SUBJECTS_DIR}:/freesurfer:ro \
  ${FMRIPREP_CONTAINER} \
  /bids /out participant \
  --participant-label ARE \
  -w /work \
  --output-spaces MNI152NLin2009cAsym:res-2 \
  --nprocs 4 \
  --fs-license-file /license.txt \
  --fs-subjects-dir /freesurfer \
  --mem 128000 \
  -v

I would also ensure that your work directory is empty and not anywhere in your BIDS directory.

Best,

Steven

Thanks for your reply! In the runFmripre.sh it’s simply the fmriprep command I pasted in the original post. So do you think that because the way I ran singularity, fmriprep may fail to find some input image files? I inherited the script from quite some time ago so perhaps things have changed since.. I will try the commands you suggested.

Appreciate your help!

Yuan

fmriprep \
../bids_datasets \
../output_fmriprep25.2.5_test \
participant \
-v \
–output-spaces MNI152NLin2009cAsym:res-2 \
-w ../bids_datasets/work/ \
–nprocs 4 \
–fs-no-reconall \
–fs-license-file ./license.txt \
–mem 128000 \
–participant-label ARE

Hi again! I tried running Singularity with the script and it ran. However, I got the exact same error message of a TraitError of “input_image”. Looks like the parameter is simply blank. But I can’t figure out what this “input_image” is. It seems it was able to locate the functional image so perhaps somehow it couldn’t find the anat image? But I checked the data structure and don’t see why..

Log and error message:


260513-10:36:01,228 cli INFO:

Telemetry system to collect crashes and errors is enabled - thanks for your feedback!. Use option ``–notrack`` to opt out.

260513-10:36:01,590 cli INFO:

Making sure the input data is BIDS compliant (warnings can be ignored in most cases).

bids-validator@1.14.10

1: [WARN] You should define ‘SliceTiming’ for this file. If you don’t provide this information slice time correction will not be possible. ‘Slice Timing’ is the time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order – rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition. (code: 13 - SLICE_TIMING_NOT_DEFINED)

./sub-WKN/func/sub-WKN_task-rest_acq-TR2500_bold.nii.gz

Please visit https://neurostars.org/search?q=SLICE_TIMING_NOT_DEFINED for existing conversations about this issue.

2: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

3: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

Please visit https://neurostars.org/search?q=TOO_FEW_AUTHORS for existing conversations about this issue.

    Summary:                Available Tasks:        Available Modalities: 

    6 Files, 54.64MB        rest                    MRI                   

    1 - Subject                                                           

    1 - Session                                                           

If you have any questions, please post on https://neurostars.org/tags/bids .

260513-10:36:17,141 nipype.workflow IMPORTANT:

Running fMRIPrep version 25.2.5

     License NOTICE ##################################################

     fMRIPrep 25.2.5

     Copyright The NiPreps Developers.

     

     This product includes software developed by

     the NiPreps Community (https://nipreps.org/).

     

     Portions of this software were developed at the Department of

     Psychology at Stanford University, Stanford, CA, US.

     

     This software is also distributed as a Docker container image.

     The bootstrapping file for the image ("Dockerfile") is licensed

     under the MIT License.

     

     This software may be distributed through an add-on package called

     "Docker Wrapper" that is under the BSD 3-clause License.

     #################################################################

260513-10:36:17,141 nipype.workflow IMPORTANT:

Building fMRIPrep’s workflow:

       \* BIDS dataset path: /bids.

       \* Participants and sessions: sub-WKN.

       \* Run identifier: 20260513-103600_9bcd0ca9-1c89-4a5d-b6da-2b7b190bf009.

       \* Output spaces: MNI152NLin2009cAsym:res-2.

       \* Pre-run FreeSurfer's SUBJECTS_DIR: /out/sourcedata/freesurfer.

260513-10:36:18,142 nipype.workflow INFO:

ANAT Stage 1: Adding template workflow

260513-10:36:18,572 nipype.workflow INFO:

ANAT Stage 2: Preparing brain extraction workflow

260513-10:36:18,658 nipype.workflow INFO:

ANAT Stage 3: Preparing segmentation workflow

260513-10:36:18,662 nipype.workflow INFO:

ANAT Stage 4: Preparing normalization workflow for [‘MNI152NLin2009cAsym’]

260513-10:36:18,669 nipype.workflow INFO:

ANAT Stage 5: Preparing surface reconstruction workflow

260513-10:36:18,686 nipype.workflow INFO:

ANAT Stage 6: Preparing mask refinement workflow

260513-10:36:18,690 nipype.workflow INFO:

ANAT No T2w images provided - skipping Stage 7

260513-10:36:18,690 nipype.workflow INFO:

ANAT Stage 8: Creating GIFTI surfaces for [‘white’, ‘pial’, ‘midthickness’, ‘sphere_reg’, ‘sphere’]

260513-10:36:18,705 nipype.workflow INFO:

ANAT Stage 8: Creating GIFTI metrics for [‘thickness’, ‘sulc’]

260513-10:36:18,711 nipype.workflow INFO:

ANAT Stage 8a: Creating cortical ribbon mask

260513-10:36:18,714 nipype.workflow INFO:

ANAT Stage 9: Creating fsLR registration sphere

260513-10:36:18,718 nipype.workflow INFO:

ANAT Stage 10: Creating MSM-Sulc registration sphere

260513-10:36:18,725 nipype.workflow INFO:

ANAT Stage 11: Creating cortical surface mask

260513-10:36:18,952 nipype.workflow INFO:

No single-band-reference found for sub-WKN_task-rest_acq-TR2500_bold.nii.gz.

260513-10:36:19,16 nipype.workflow INFO:

Stage 1: Adding HMC boldref workflow

260513-10:36:19,24 nipype.workflow INFO:

Stage 2: Adding motion correction workflow

260513-10:36:19,30 nipype.workflow INFO:

No fieldmap correction - skipping Stage 3

260513-10:36:19,30 nipype.workflow INFO:

Stage 4: Adding coregistration boldref workflow

Process Process-2:

Traceback (most recent call last):

File “/app/.pixi/envs/fmriprep/lib/python3.12/multiprocessing/process.py”, line 314, in _bootstrap

self.run()

File “/app/.pixi/envs/fmriprep/lib/python3.12/multiprocessing/process.py”, line 108, in run

self.\_target(\*self.\_args, \*\*self.\_kwargs)

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/workflow.py”, line 116, in build_workflow

retval\['workflow'\] = init_fmriprep_wf()

                     ^^^^^^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/base.py”, line 108, in init_fmriprep_wf

single_subject_wf = init_single_subject_wf(subject_id, sessions, name=wf_name)

                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/base.py”, line 875, in init_single_subject_wf

bold_wf = init_bold_wf(

          ^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/bold/base.py”, line 248, in init_bold_wf

bold_fit_wf = init_bold_fit_wf(

              ^^^^^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/workflows/bold/fit.py”, line 561, in init_bold_fit_wf

enhance_boldref_wf = init_enhance_and_skullstrip_bold_wf(omp_nthreads=omp_nthreads)

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/niworkflows/func/util.py”, line 453, in init_enhance_and_skullstrip_bold_wf

ApplyTransforms(

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/ants/base.py”, line 76, in _init_

super().\__init_\_(\*\*inputs)

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py”, line 633, in _init_

super().\__init_\_(\*\*inputs)

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/core.py”, line 204, in _init_

self.inputs.trait_set(\*\*inputs)

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/traits/has_traits.py”, line 1458, in trait_set

setattr(self, name, value)

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/traits_extension.py”, line 325, in validate

value = super().validate(objekt, name, value, return_pathlike=True)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/nipype/interfaces/base/traits_extension.py”, line 135, in validate

self.error(objekt, name, str(value))

File “/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/traits/base_trait_handler.py”, line 74, in error

raise TraitError(

traits.trait_errors.TraitError: The ‘input_image’ trait of a _FixTraitApplyTransformsInputSpec instance must be a pathlike object or string representing an existing file, but a value of ‘[]’ <class ‘str’> was specified.

Hi @Yuan_Tao,

In the future, please format your outputs as code text (you can see I have been editing your posts for you) by using the </> button in the text editor.

Can you provide the full script you used? It looks like it is still looking for FreeSurfer data in the default location which means you might have not specified the --fs-subjects-dir correctly.

May you also provide the tree directory structure of an example subject’s raw data, as well as the outputs of fslinfo on one of the BOLD files?

Best,

Steven

My apologies! I’m not very familiar with this forum’s yet. Will do.

I didn’t specify it, because I don’t have an existing FreeSurfer output yet and I do intend to run it anyway, per your suggestion. Do I understand it correctly that this argument is for re-using existing FreeSurfer outputs? The script is as follows:

FMRIPREP_CONTAINER=~/fmriprep-25.2.5.simg
BIDS=/home/bids_test/
OUT=/home/output_fmriprep25.2.5_test/
WORK=/home/work_test25.2.5/
LICENSE=/home/ytao13/scripts/license.txt
#FREESURFER_SUBJECTS_DIR=/path/to/freesurfer_outputs/

singularity run 
-e 
–writable-tmpfs 
-B ${BIDS}:/bids:ro 
-B ${OUT}:/out 
-B ${WORK}:/work 
-B ${LICENSE}:/license.txt 
${FMRIPREP_CONTAINER} 
/bids /out participant 
–participant-label WKN 
-w /work 
–output-spaces MNI152NLin2009cAsym:res-2 
–nprocs 4 
–fs-license-file /license.txt 
–mem 128000 
-v

Here it is. I ran thru BIDS Validator and it’s fine, except warnings about various missing keys.

Tree structure:

bids_test

├── dataset_description.json

├── participants.tsv

└── sub-WKN

    ├── anat

    │   ├── sub-WKN_T1w.json

    │   └── sub-WKN_T1w.nii.gz

    └── func

        ├── sub-WKN_task-rest_acq-TR2500_bold.json

        └── sub-WKN_task-rest_acq-TR2500_bold.nii.gz


fslinfo for the BOLD image:

data_type INT16

dim1 80

dim2 80

dim3 47

dim4 185

datatype 4

pixdim1 3.000000

pixdim2 3.000000

pixdim3 3.000122

pixdim4 2.500000

cal_max 0.000000

cal_min 0.000000

file_type NIFTI-1+

In that case you can just have fMRIPrep run FreeSurfer for you, unless you have special reason not to (e.g. you are using a non-standard software like FastSurfer, longitudinal FreeSurfer, or recon-all-clinical).

That argument is for specifying where the FreeSurfer outputs are or should be. If they are not found in that directory, they will be produced there by fMRIPrep.

Hmm, this seems fine to me. Can you see as a test if rolling back to an earlier version (e.g. 24.X.X) causes it to succeed? If so, then it might be a bug in the current version that should be reported on the GitHub. If it still fails on an older version then I am not sure how else to troubleshoot without getting access to the data myself.

Best,

Steven

Hi Steve,

Thanks again for your help! Just wanted to let you know that I tried running the same thing with 24.0.0 and it ran successfully without incident. Everything was the same, same dataset, same script, same computers.

Best,

Yuan

1 Like

hi @Yuan_Tao,

I would open a bug report on the fmriprep GitHub page about 25.2.5 not working then.

Best,

Steven