BIDS Validator Failing on Windows

Hi,

For some subjects, I am running into a problem when trying to run them in fMRIPrep. I am getting the following error message for them:

    1: [ERR] Internal error. SOME VALIDATION STEPS MAY NOT HAVE OCCURRED (code: 0 - INTERNAL ERROR)

And

Traceback (most recent call last):
File “/opt/conda/bin/fmriprep”, line 8, in
sys.exit(main())
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/run.py”, line 39, in main
parse_args()
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/parser.py”, line 790, in parse_args
validate_input_dir(config.environment.exec_env, opts.bids_dir, opts.participant_label)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/utils/bids.py”, line 186, in validate_input_dir
subprocess.check_call([‘bids-validator’, str(bids_dir), ‘-c’, temp.name])
File “/opt/conda/lib/python3.9/subprocess.py”, line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘bids-validator’, ‘/data’, ‘-c’, ‘/tmp/tmprneafg8m.json’]’ returned non-zero exit status 1.

But I have checked over my code for dcm2bids and I don’t seem to have made an error, at least I have done things consistently as I did for other subjects I ran successfully. Does anyone know what might be causing this?

Many thanks for any help you can give

Hi @JarrettC,

Please also provide the rest of the info that was requested by the Software Support post template so that we can best assist you.

Best,
Steven

Hi Stephen,

Thanks for your reply, here is the full information:

docker run -ti --rm -v “/mnt/h/SPM_data/445/bids/:/data:ro” -v “/mnt/h/SPM_data/445/bids/derivatives/fmriprep:/out” -v “/mnt/h/445/tmp/:/work” -v “/mnt/h/SPM_data/445/:/fslic:ro” -v “/mnt/h/SPM_data/445/:/plugin:ro” nipreps/fmriprep:22.0.2 /data /out participant --participant-label 25453 -w /work --fs-license-file /fslic/license.txt --output-spaces anat MNI152NLin2009cAsym fsnative fsaverage --use-plugin /plugin/plugin_mem.yml --stop-on-first-crash --ignore sbref fieldmaps --bold2t1w-init header
You are using fMRIPrep-22.0.2, and a newer version of fMRIPrep is available: 23.1.4.
Please check out our documentation about how and when to upgrade:
https://fmriprep.readthedocs.io/en/latest/faq.html#upgrading
bids-validator@1.8.0

    1: [ERR] Internal error. SOME VALIDATION STEPS MAY NOT HAVE OCCURRED (code: 0 - INTERNAL ERROR)

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


    Summary:                   Available Tasks:        Available Modalities:
    1306 Files, 45.22GB                                MRI
    75 - Subjects
    1 - Session


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

Traceback (most recent call last):
File “/opt/conda/bin/fmriprep”, line 8, in
sys.exit(main())
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/run.py”, line 39, in main
parse_args()
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/parser.py”, line 790, in parse_args
validate_input_dir(config.environment.exec_env, opts.bids_dir, opts.participant_label)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/utils/bids.py”, line 186, in validate_input_dir
subprocess.check_call([‘bids-validator’, str(bids_dir), ‘-c’, temp.name])
File “/opt/conda/lib/python3.9/subprocess.py”, line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘bids-validator’, ‘/data’, ‘-c’, ‘/tmp/tmp2_2u836e.json’]’ returned non-zero exit status 1.

I have taken a look at the Search results for 'INTERNAL' - Neurostars ERROR however the posts seem to have quite different issues.

Many thanks,
C

Does this occur when validating your dataset at https://bids-standard.github.io/bids-validator/? If not, then it’s fine, and just use --skip-bids-validation for your dataset. If so, then it is a problem with your dataset or the validator, and including details about fMRIPrep invocation or errors is distracting from the problems.

I most often see this on datasets where there’s a byte-order mark in a JSON file. If you run file X.json on a JSON file, you’ll see X.json: JSON data. If you see something else, then it is a bad JSON file. I generally use jq and sponge (from moreutils) to clean them up:

jq . < X.json | sponge X.json

Hello effigies,

Thank you for your response! When validating the dataset I get the following error:

Your dataset is not a valid BIDS dataset.

Error 1: [Code 61] QUICK_VALIDATION_FAILED

Click here for more information about this issue

Quick validation failed - the general folder structure does not resemble a BIDS dataset. Have you chosen the right folder (with “sub-*/” subfolders)? Check for structural/naming issues and presence of at least one subject.

Though I have taken another look at my bids dataset for this subject and compared it with another which ran successfully in fMRIPrep and they look identical regarding structure format (both the folders and the file structure). When I look into the error message the bids validator provided, I see

The sub-25453_T1w.json file is the same format as used in previously successful bids datasets. Perhaps it is a problem with the json file? I’m sorry, I’m not sure if I understand what you mean regarding running a json file? When I open every json file in the bids dataset, all json files look normal to me when comparing with other json files in a successful bids dataset. I am still a little new to bids/fmriprep.

Thank you again for your help!

Hi @JarrettC,

Please make sure your input to the validator is the root of the dataset, which contains the sub-xx folders.

Best,
Steven

Hi Steven,

My directory is “H:\SPM_data\445\bids\sub-25453” which contains my “anat” “func” and “fmap” folders. I have used “sub-25453” as my input into into the bids validator which returns that error. Using “bids” folder as the input says “20 files deleted” with nothing else displayed.

Many thanks again for your help.

Best regards,
Chelsea

Can you please print the full command for the BIDS validator (input should be bids folder) and full output from the validator? And please format your code by surrounding it in tick marks (or press the </> button in the text editor).

Hi Steven,

Yes, I used this as my BIDS validator code (sorry, earlier I had checked it using the online bids validator). The full code:

<docker run -ti --rm -v /SPM_data/445/bids:/data:ro bids/validator /data>

And the full output:

bids-validator@1.13.1
1: [ERR] Quick validation failed - the general folder structure does not resemble a BIDS dataset. Have you chosen the right folder (with “sub-*/” subfolders)? Check for structural/naming issues and presence of at least one subject. (code: 61 - QUICK_VALIDATION_FAILED)
.data

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

But the folder structures look the same to me as for the same as for the successfully ran subjects when I have checked them.

Thanks again for your assistance
C

It looks like you are inputting a path with Unix-like syntax (that is, a forward slash in the path to separate folders), but you are on a windows machine, which uses back slashes. For windows I recommend installing Cygwin to give a Linux like terminal for windows.

Best,
Steven

Hi Steven,

Thanks again for your reply/time. I am using WSL with Ubuntu. I was under the impression that using WSL means that I should stick to the Linux syntax?

Best regards,
C

Hello Steven,

I have also just found this webpage https://www.npmjs.com/package/bids-validator/v/1.4.2 and followed instructions for the Python library, using the following code:

<BIDSValidator().is_bids(‘/SPM_data/445/bids:/data:ro bids/validator’)>

This simply returns the message:

False

(Sorry, I am new to bids validator)

I will check over the data again to look for any incompatibilities in the code/source data.

Kind regards,
C

Hi @JarrettC,

The docker container will provide a more verbose output than the python package. And in your paths, you do not have the H drive indicated anywhere.

The input to the python function should only be the path to your dataset. You also included the path modification arguments that are specific to docker (e.g :/data:ro) as well as the docker container name (bids/validator).

Best,
Steven