Help on IntendedFor error

I’m stumped by this error, hoping someone has some ideas:

This the error message from running bids-validator (within the HCP pipeline):

 1: [ERR] 'IntendedFor' field needs to point to an existing file. (code: 37 - INTENDED_FOR)
                    Evidence: ses-1/func/sub-C026_ses-1_task-SWT1_dir-PA_run-4_bold.nii.gz
                    Evidence: ses-1/func/sub-XXXX_ses-1_task-PAS_dir-PA_run-2_bold.nii.gz

ls BIDS_HCP/NIFTI/sub-XXXX/ses-1/func/sub-XXXX_ses-1_task-SWT1_dir-PA_run-4_bold.nii.gz

ls BIDS_HCP/NIFTI/sub-XXXX/ses-1/func/sub-XXXX_ses-1_task-PAS_dir-PA_run-2_bold.nii.gz

These files clearly exist, and the bids_validator seems to have no problem with the other functional files (runs 1-3 for SWT1 and run 1 for PAS).

Any ideas, or thoughts about how to debug this?


Mark W.


Few things:
EDITED: I was wrong, sorry about that!

  1. What do the contents of your fmap json files look like?

  2. Can you show the file structure for a single subject, e.g. with the tree command?


Thanks for the quick reply.

The one thing I can think of, which makes these two files unique compared to the others, is that they are the last one referred to in the intendedfor list (there are two field maps, labeled with run-1/2), although still not sure why that would throw an error???

  1. Not sure what you mean by not a valid suffix name, see option #3 in the document you refer to (direct field mapping, as is produced by the philips scanner).

  2. See attached file (extension changed from json to txt to allow attachment). File generated by dcm2niix, with additional fields for IntendedFor’s and Units.
    sub-XXXX_ses-1_run-1_fieldmap.txt (2.0 KB)

├── dataset_description.json
└── sub-XXXX
└── ses-1
├── anat
│ ├── sub-XXXX_ses-1_acq-3D_T1w.json
│ ├── sub-XXXX_ses-1_acq-3D_T1w.nii.gz
│ ├── sub-XXXX_ses-1_acq-3D_T2w.json
│ └── sub-XXXX_ses-1_acq-3D_T2w.nii.gz
├── dwi
│ ├── sub-XXXX_ses-1_dir-AP_dwi.bval
│ ├── sub-XXXX_ses-1_dir-AP_dwi.bvec
│ ├── sub-XXXX_ses-1_dir-AP_dwi.json
│ ├── sub-XXXX_ses-1_dir-AP_dwi.nii.gz
│ ├── sub-XXXX_ses-1_dir-PA_dwi.bval
│ ├── sub-XXXX_ses-1_dir-PA_dwi.bvec
│ ├── sub-XXXX_ses-1_dir-PA_dwi.json
│ └── sub-XXXX_ses-1_dir-PA_dwi.nii.gz
├── fmap
│ ├── sub-XXXX_ses-1_run-1_fieldmap.json
│ ├── sub-XXXX_ses-1_run-1_fieldmap.nii.gz
│ ├── sub-XXXX_ses-1_run-1_magnitude.json
│ ├── sub-XXXX_ses-1_run-1_magnitude.nii.gz
│ ├── sub-XXXX_ses-1_run-2_fieldmap.json
│ ├── sub-XXXX_ses-1_run-2_fieldmap.nii.gz
│ ├── sub-XXXX_ses-1_run-2_magnitude.json
│ └── sub-XXXX_ses-1_run-2_magnitude.nii.gz
└── func
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-1_bold.json
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-1_bold.nii.gz
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-1_sbref.json
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-1_sbref.nii.gz
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-2_bold.json
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-2_bold.nii.gz
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-2_sbref.json
├── sub-XXXX_ses-1_task-PAS_dir-PA_run-2_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-1_bold.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-1_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-1_sbref.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-1_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-2_bold.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-2_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-2_sbref.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-2_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-3_bold.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-3_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-3_sbref.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-3_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-4_bold.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-4_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-4_sbref.json
├── sub-XXXX_ses-1_task-SWT1_dir-PA_run-4_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-1_bold.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-1_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-1_sbref.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-1_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-2_bold.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-2_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-2_sbref.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-2_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-3_bold.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-3_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-3_sbref.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-3_sbref.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-4_bold.json
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-4_bold.nii.gz
├── sub-XXXX_ses-1_task-SWT2_dir-PA_run-4_sbref.json
└── sub-XXXX_ses-1_task-SWT2_dir-PA_run-4_sbref.nii.gz

Apologies, you were right about the suffix.

In your text file, you have each nifti under its own IntendedFor argument, when you should only have one IntendedFor field that contains a list of each nifti.

So it should look like:

"IntendedFor": [file1,

Thanks, but that doesn’t seem to have fixed the problem, still get the same error with that format. I’ve gotten rid of all of the functional tasks but one, so now there is only one file in the intendedFor list, and it’s still failing. And I’m getting what seems to be contradictory error messages, because if I intentionally name the file incorrectly, then I get an error that the IntendedFor field has to point to an existing file, I don’t get that error when the file is correctly named, but then get the error that there is no field map for that file???

Any thought would be most appreciated!


Can you report the full trace backs for those errors?

Sorry, one thing I should have pointed out before, although not sure it is relevant. The bids-validator is being run within the singularity package of the HCP pipeline.

Here’s the full run command and error traceback (I’m not worried about the warnings, haven’t copied the event files over, first need to figure out this issue):

singularity run --bind /gs/gsfs0/users/mrrc-all/PROJECTS/P65-ALL/,/gs/gsfs0/hpc02/users/mrrc-all/PROJECTS/P65-ALL/:/mnt SCRIPTS/hcppipelines_latest.sif --participant_label ${subj} --stages fMRIVolume --license_key “48146” --anat_unwarpdir x /mnt/BIDS_HCP/NIFTI/ /mnt/BIDS_HCP/hcp_output/ participant
INFO: Converting SIF file to temporary sandbox…
WARNING: underlay of /usr/share/zoneinfo/Etc/UTC required more than 50 (73) bind mounts
bids-validator /mnt/BIDS_HCP/NIFTI/

    1: [WARN] You should define 'EffectiveEchoSpacing' for this file. If you don't provide this information field map correction will not be possible. (code: 8 - EFFECTIVE_ECHO_SPACING_NOT_DEFINED)

    Please visit for existing conversations about this issue.

    2: [WARN] You should define 'TotalReadoutTime' for this file. If you don't provide this information field map correction using TOPUP might not be possible. (code: 9 - TOTAL_READOUT_TIME_NOT_DEFINED)

    Please visit for existing conversations about this issue.

    3: [WARN] Task scans should have a corresponding events.tsv file. If this is a resting state scan you can ignore this warning or rename the task to include the word "rest". (code: 25 - EVENTS_TSV_MISSING)

    Please visit for existing conversations about this issue.

    4: [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 for existing conversations about this issue.

    Summary:                Available Tasks:        Available Modalities:
    62 Files, 1.02GB        PAS                     T1w
    1 - Subject             SWT1                    T2w
    1 - Session             SWT2                    dwi

    If you have any questions, please post on

Traceback (most recent call last):
File “/”, line 435, in
f"No fieldmaps found for BOLD {fmritcs}. Consider --procesing_mode [legacy | auto ]."
AssertionError: No fieldmaps found for BOLD /mnt/BIDS_HCP/NIFTI/sub-XXXX/ses-1/func/sub-XXXX_ses-1_task-PAS_run-1_bold.nii.gz. Consider --procesing_mode [legacy | auto ].
INFO: Cleaning up image…

Okay, this doesn’t seem like a BIDS error and may not be a path error either, perhaps HCP expects a different kind of fieldmap?

I can see HCP pipelines does not support GE fieldmaps at the moment.

Thanks! I didn’t see that, although had already tried earlier today to convert the fieldmaps to phasediff’s and was still getting the same errors. But I hadn’t deleted the fieldmap images, will see if that was causing the problem.