'IntendedFor' field needs to point to an existing file

The following error is returned when running the BIDS validator. It occurs for every file that is pointed to within the *epi.json that is stored within the fmap directory.

The error is as follows:
‘IntendedFor’ field needs to point to an existing file.
Location:
cotdata.bids/sub-7640363/ses-00/fmap/sub-7640363_ses-00_acq-rest_dir-AP_run-01_epi.nii.gz
Reason:
‘IntendedFor’ property of this fieldmap (’/sub-7640363/ses-00/fmap/sub-7640363_ses-00_acq-rest_dir-AP_run-01_epi.nii.gz’) does not point to an existing file(‘func/sub-7640363_ses-00_task-rest_run-01_bold.nii.gz’). Please mind that this value should not include subject level directory (’/sub-7640363/’).
Evidence:
func/sub-7640363_ses-00_task-rest_run-01_bold.nii.gz

The BIDS directory contents are as follows:
sub-7640363/ses-00/sub-7640363_ses-00_scans.tsv
sub-7640363/ses-00/anat:
sub-7640363_ses-00_T1w.json sub-7640363_ses-00_T1w.nii.gz sub-7640363_ses-00_T2w.json sub-7640363_ses-00_T2w.nii.gz
sub-7640363/ses-00/fmap:
sub-7640363_ses-00_acq-rest_dir-AP_run-01_epi.json sub-7640363_ses-00_acq-rest_dir-PA_run-01_epi.json
sub-7640363_ses-00_acq-rest_dir-AP_run-01_epi.nii.gz sub-7640363_ses-00_acq-rest_dir-PA_run-01_epi.nii.gz
sub-7640363_ses-00_acq-rest_dir-AP_run-02_epi.json sub-7640363_ses-00_acq-rest_dir-PA_run-02_epi.json
sub-7640363_ses-00_acq-rest_dir-AP_run-02_epi.nii.gz sub-7640363_ses-00_acq-rest_dir-PA_run-02_epi.nii.gz
sub-7640363/ses-00/func:
sub-7640363_ses-00_task-rest_run-01_bold.json sub-7640363_ses-00_task-rest_run-02_bold.json
sub-7640363_ses-00_task-rest_run-01_bold.nii.gz sub-7640363_ses-00_task-rest_run-02_bold.nii.gz
sub-7640363_ses-00_task-rest_run-01_events.tsv sub-7640363_ses-00_task-rest_run-02_events.tsv
… note that the file reported “nonexistent” by the BIDS validator is indeed in the directory - highlighted in bold.

_This error is returned with the BIDS validator, however, other BIDS-apps such as fmriprep acknowledge this file as existent. I am not sure what I am doing wrong; does it have to do with including “sess-00” in my json file?

Best,
Scott_

Hi Scott,

I have found that the ‘IntendedFor’ error comes from how the path is provided in the ‘IntendedFor’ field. May I see the json file you have mentioned? I think the ses-00 should be present in the json, only the sub-7640363 level should not be included.

Thank you,
Franklin

1 Like

Hi Scott,

The IntendedFor field needs to be relative to the subject folder so you need to include the session level.

ses-00/func/sub-7640363_ses-00_task-rest_run-01_bold.nii.gz

See http://bids.neuroimaging.io/bids_spec.pdf#page=26 for details and examples.

Hi,
I have the same error with my phantom data and it seems I have already included the session and there is no problem with the file name. But still I have the error. Could you please help? This is the link to my question/discussion, but here is the problem:

I have inserted the IntendedFor field to my AP and PA b0 images of the DWI data in the corresponding JSON files that point to the DWI data. The DWI image is present, but still, the bids-validator complains and gives the following error:
Location
UC042121QA/sub-QA042121/ses-phantom/fmap/sub-QA042121_ses-phantom_acq-dwib0_dir-AP_epi.nii.gz

Reason
'IntendedFor' property of this fieldmap ('/sub-QA042121/ses-phantom/fmap/sub-QA042121_ses-phantom_acq-dwib0_dir-AP_epi.nii.gz') does not point to an existing file('ses-phantom/dwi/sub-QA042121_ses-phantom_dwi.nii.gz'). Please mind that this value should not include subject level directory ('/sub-QA042121/').

Evidence
ses-phantom/dwi/sub-QA042121_ses-phantom_dwi.nii.gz

This is how I have inserted the IntendedFor field:
"IntendedFor": ["ses-phantom/dwi/sub-QA042121_ses-phantom_dwi.nii.gz"],

Even if I pass the path to DWI data as a string and not as a list, I still get the same error. I also have the correct permissions in my parent directory. Is there any issue with any keyword in the subject/session name maybe e.g. phantom?

Please help!
Thanks.

Solved! For some unknown reason, after my dicoms were converted to bids, my DWI data was added to the .bidsignore file! Once I removed it from the .bidsignore file, the data passed the bids validation.

MANAGED BY INCF