XCP-D error: ValueError: dictionary update sequence element #0 has length 4; 2 is required due to problem with BIDSLayout

Summary of what happened:

I am trying to run the following code and get the following error. The thing is, I have another session, which I’ve derived to the folder iter6s2 and BIDSLayout can load this derivative.

Edit: I can load resting states from iter6s2 using .get(subject='avl200', task='rest', extension='nii.gz', suffix='bold', return_type='filename'). But again, iter6s1 does not load at all.

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

singularity -d run -B $HOME/.cache/templateflow:/opt/templateflow,/group/tuominen/EmoSal_BIDS:/mnt \
/group/tuominen/EmoSal_BIDS/images/xcp_d-0.6.0.simg \
/mnt/derivatives/iter6s1 \
/mnt/derivatives/xcp-d_output_s1/ participant \
--bids-filter-file /mnt/scripts/bids_filter_xcpd.json \
--combineruns --nuisance-regressors 36P \
--min-coverage 0.5 \
--min-time 100 --dummy-scans 0 --bpf-order 2 --lower-bpf 0.01 --upper-bpf 0.08 \
--head-radius auto --fd-thresh 0.3 -v

Version:

0.6.0

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

Singularity

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


[rawdata_errors.txt|attachment](upload://9tujxukJctDqZsspRz9DCoURODF.txt) (35.9 KB)

Relevant log outputs (up to 20 lines):

and I get this error:

Process Process-2:
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/local/miniconda/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/cli/run.py", line 888, in build_workflow
    layout = BIDSLayout(str(opts.fmri_dir), validate=False, derivatives=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/layout.py", line 154, in __init__
    indexer(self)
  File "/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/index.py", line 151, in __call__
    self._index_metadata()
  File "/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/index.py", line 404, in _index_metadata
    file_md.update(pl())
ValueError: dictionary update sequence element #0 has length 4; 2 is required

I can replicate this error when using BIDSLayout on it’s own:

>>> from bids import BIDSLayout
>>> processed = BIDSLayout(root='/group/tuominen/EmoSal_BIDS/derivatives/iter6s1', derivatives=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/group/tuominen/anaconda3/lib/python3.11/site-packages/bids/layout/layout.py", line 152, in __init__
    indexer(self)
  File "/group/tuominen/anaconda3/lib/python3.11/site-packages/bids/layout/index.py", line 111, in __call__
    self._index_metadata()
  File "/group/tuominen/anaconda3/lib/python3.11/site-packages/bids/layout/index.py", line 375, in _index_metadata
    file_md.update(pl())
ValueError: dictionary update sequence element #0 has length 4; 2 is required

Screenshots / relevant information:


Hi @ramroom.hamati,

What are the contents of the bids filter file? Do you get errors without it? Are these fMRIPrep derivatives, and if so, why are folders divided by session at the top level (and not within subjects)?

Best,
Steven

Hey @Steven ,

Here is the BIDS filter file, and I get the same error with and without it:

{
   "bold": {
      "space": ["MNI152NLin6Asym"],
      "task": ["rest"]
   }
}

They are fMRIprep derivatives, split at the top-level b/c I wanted to avoid averaging T1s from both sessions: How fmriprep deals with multiple T1 ? · Issue #2227 · nipreps/fmriprep · GitHub.

Can you return the output of tree run on one of the derivatives folders?

Best,
Steven

result.txt (17.2 KB)

I’ve attached it!

Is that /mnt/derivatives/iter6s1?

Apologies. The above tree was for 1 subject. Here is /mnt/derivatives/iter6s1
result2.txt (413.3 KB)