Description
A regression was introduced between v2.0.11 and v2.4.1 causing the validator to crash with an uncaught TypeError: Expected a finite number, got number: NaN.
This seems to happen specifically when evaluating datasets that utilize symlinks.
Context / Dataset Setup
We are currently preparing a dataset for release and utilizing symlinks to map data across different subject IDs (sub-*) to avoid duplicating heavy imaging files on disk.
- Works perfectly in:
bids-validator v2.0.11 (Successfully resolves symlinks, reads the 7.53 GB dataset, and returns a clean validation summary).
- Crashes in:
bids-validator v2.4.1 (Fails during the formatSummary stage while calculating file/byte metrics).
Error Log (v2.4.1)
When executing via Deno or within a Singularity container mounting the dataset, the execution panics at the summary output step:
singularity exec --containall -B "${bids_dir}":"${bids_dir}" "${dcm2bids_img}" deno run --allow-write -ERN jsr:@bids/validator ${bids_dir} --ignoreWarnings --outfile ${bids_dir}/bids_validator_output.txt
╭ Warning
│
│ Ignored build scripts for packages:
│ npm:core-js-pure@3.49.0
│
│ Lifecycle scripts are only supported when using a `node_modules` directory.
│ Enable it in your deno config file:
│ "nodeModulesDir": "auto"
╰─
error: Uncaught (in promise) TypeError: Expected a finite number, got number: NaN
throw new TypeError(`Expected a finite number, got ${typeof num}: ${num}`);
^
at format ([https://jsr.io/@std/fmt/1.0.10/bytes.ts:123:11](https://jsr.io/@std/fmt/1.0.10/bytes.ts:123:11))
at formatSummary ([https://jsr.io/@bids/validator/2.4.1/src/utils/output.ts:199:51](https://jsr.io/@bids/validator/2.4.1/src/utils/output.ts:199:51))
at consoleFormat ([https://jsr.io/@bids/validator/2.4.1/src/utils/output.ts:36:15](https://jsr.io/@bids/validator/2.4.1/src/utils/output.ts:36:15))
at main ([https://jsr.io/@bids/validator/2.4.1/src/main.ts:45:21](https://jsr.io/@bids/validator/2.4.1/src/main.ts:45:21))
at async [https://jsr.io/@bids/validator/2.4.1/src/bids-validator.ts:4:16](https://jsr.io/@bids/validator/2.4.1/src/bids-validator.ts:4:16)
## Expected Behavior (Working output in v2.0.11)
Downgrading back to 2.0.11 runs smoothly on the exact same directory structure and generates the expected output report:
```bash
$ deno run --allow-write -ERN jsr:@bids/validator --version
bids-validator 2.0.11
$ deno run --allow-write -ERN jsr:@bids/validator ${bids_dir} --ignoreWarnings --outfile ${bids_dir}/bids_validator_output.txt
This dataset appears to be BIDS compatible.
Summary: Available Tasks: Available Modalities:
100 Files, 7.53 GB rest MRI
2 - Subjects 2 - Sessions
If you have any questions, please post on [https://neurostars.org/tags/bids](https://neurostars.org/tags/bids).
Suspected Cause
Looking at the stack trace, the crash occurs in src/utils/output.ts line 199 inside formatSummary. It passes a NaN type to Deno's standard library byte formatter (@std/fmt/bytes).
It is highly likely that the file walk logic in newer versions of the validator is failing to correctly resolve the sizes or counts of symlinked files, feeding an undefined/null mathematical value into the total bytes calculator.
Environment Info
- Deno version: Latest stable
- bids-validator version 2.4.1 (bug), 2.0.11 (working)
- OS / Environment: Linux Singularity container environment
Description
A regression was introduced between
v2.0.11andv2.4.1causing the validator to crash with an uncaughtTypeError: Expected a finite number, got number: NaN.This seems to happen specifically when evaluating datasets that utilize symlinks.
Context / Dataset Setup
We are currently preparing a dataset for release and utilizing symlinks to map data across different subject IDs (
sub-*) to avoid duplicating heavy imaging files on disk.bids-validator v2.0.11(Successfully resolves symlinks, reads the 7.53 GB dataset, and returns a clean validation summary).bids-validator v2.4.1(Fails during theformatSummarystage while calculating file/byte metrics).Error Log (v2.4.1)
When executing via Deno or within a Singularity container mounting the dataset, the execution panics at the summary output step:
Suspected Cause
Looking at the stack trace, the crash occurs in src/utils/output.ts line 199 inside formatSummary. It passes a NaN type to Deno's standard library byte formatter (@std/fmt/bytes).
It is highly likely that the file walk logic in newer versions of the validator is failing to correctly resolve the sizes or counts of symlinked files, feeding an undefined/null mathematical value into the total bytes calculator.
Environment Info