Skip to content

Sidecars with a space before the colon after "HED" are not validated #975

Closed

Description

@VisLab

What happens

BidsDataset.create decides whether a JSON sidecar has HED by searching the raw file text for the
exact characters "HED": (src/bids/types/dataset.js:205):

if (!jsonText.includes('"HED":')) {
  return sidecarIssues
}

JSON allows spaces and line breaks before the colon, so a valid sidecar such as

{ "trial_type": { "HED" : { "go": "Sensory-event, Blech" } } }

fails the check. The sidecar is dropped without any issue, and the dataset reports no errors.

How to reproduce

Make a dataset with a dataset_description.json containing "HEDVersion": "8.4.0" and a
task-go_events.json containing the sidecar above. Validate it with BidsDataset.create and
dataset.validate().

  • Written "HED":, the sidecar is loaded and Blech is reported as TAG_INVALID.
  • Written "HED" :, no sidecar is loaded and nothing is reported.

Expected

Every sidecar that has a HED key is validated, however the JSON is spaced.

Suggested fix

Parse the JSON first, then skip the sidecar only if none of its top-level values is an object with a
HED key. Add a test with "HED" : and one with a line break before the colon.

Same bug elsewhere

https://github.com/hed-standard/hed-typescript has the same check (issue 320).

Activity

  1. VisLab commented on Nov 11, 2026

    @VisLab
    MemberAuthor

    Closed by PR #977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions