"AssertionError: Conflicting study identifiers found" in heudiconv

My sample folders are organized in this way.
I use Philips fMRI data from ADNI, and each subject has different imaging date numbers. In other words, multiple subjects with multiple sessions without any rule.

  • Myproject
    • Dicom2
      • 130S4883
        • 20120103
          • anat
          • func
        • 20130506
          • anat
          • func
      • 136S4517
        • 20140506
          • anat
          • func
        • 20151104
          • anat
          • func
        • 20161107
          • anat
          • func

And I used heudiconv on Linux terminal.
The code I used is attached below.

for subject in $(ls -1 /home/rrt/MyProject/Dicom2/); do
for session in $(ls -1 /home/rrt/MyProject/Dicom2/${subject/}); do
sudo docker run --rm -it
-v /home/rrt/MyProject:/base
-d /base/Dicom2/{subject}/{session}/* /*.dcm
-o /base/Nifti2_sess2/
-f /base/Nifti2_sess2/code/convertall.py
-s ${subject}
-ss ${session}
-c dcm2niix -b

Error such as “AssertionError: Conflicting study identifiers found [,].” occured.
What should I do?

Below is the convertall.py file.

def infotodict(seqinfo):
# Section 1: These key definitions should be revised by the user scanner.
data = create_key('run-{item:03d}')
t1w = create_key('sub-{subject}/{session}/anat/sub-{subject}_{session}_T1w')
func_rest = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_task-rest_bold')

# Section 1b: This data dictionary (below) should be revised by the user.
info = {data: [], t1w: [], func_rest: []}
last_run = len(seqinfo)

# Section 2: These criteria should be revised by user.
for idx, s in enumerate(seqinfo):
    if ('MPRAGE' in s.protocol_name) and (s.dim3 == 170):
    if ('Resting' in s.protocol_name):
return info

Hi, we ran into the same error message, what would be a good way to investigate that problem ?