Skip to content

upload should point to the validation log file #1859

@yarikoptic

Description

@yarikoptic

ATM it still just

2026-05-20 12:09:32,991 [ WARNING] One or more assets failed validation.  Consult the logfile for details.
2026-05-20 12:09:38,280 [    INFO] Logs saved in /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473.log
Traceback (most recent call last):
  File "/home/yoh/proj/dandi/dandi-cli/.venv/bin/dandi", line 10, in <module>
...
  File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 326, in process_path
    raise UploadError("failed validation")
dandi.exceptions.UploadError: failed validation

which is really not user friendly. We should

  • not show traceback for validation error'ed upload (nothing to fix/traceback in the code)
  • point to the log file, potentially with full dandi validate --load ... command to run
  • potentially even provide a brief summary of validation errors!
full log
❯ DANDI_DEVEL=1 dandi upload -i dandi --upload-dandiset-metadata --allow-any-path sourcedata/aind-sample.nwb dataset_description.json README.md
2026-05-20 12:09:31,685 [    INFO] Found 4 files to consider
PATH                       SIZE         ERRORS     PROGRESS STATUS                MESSAGE            
dandiset.yaml              3.0 kB                           updated metadata                         
README.md                  364 Bytes       0                done                                     
dataset_description.json   296 Bytes       1                ERROR                 failed validation  
sourcedata/aind-sample.nwb 580.2 MB        1                ERROR                 failed validation  
Summary:                   580.2 MB  2 with errors          1 updated metadata    2 failed validation
                                                            1 done                                   
                                                            2 ERROR                                  
2026-05-20 12:09:32,991 [ WARNING] One or more assets failed validation.  Consult the logfile for details.
2026-05-20 12:09:38,280 [    INFO] Logs saved in /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473.log
Traceback (most recent call last):
  File "/home/yoh/proj/dandi/dandi-cli/.venv/bin/dandi", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/.venv/lib/python3.11/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/dandi/cli/base.py", line 126, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-cli/dandi/cli/cmd_upload.py", line 113, in upload
    upload_(
  File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 505, in upload
    raise upload_err
  File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 326, in process_path
    raise UploadError("failed validation")
dandi.exceptions.UploadError: failed validation
DANDI_DEVEL=1 dandi upload -i dandi --upload-dandiset-metadata    README.md  5.13s user 0.50s system 36% cpu 15.626 total
❯ ls -ld /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473*
-rw-rw-r-- 1 yoh yoh 23499 May 20 12:09 /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473.log
-rw-rw-r-- 1 yoh yoh  4892 May 20 12:09 /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473_validation.jsonl
❯ dandi validate --help
Usage: dandi validate [OPTIONS] [PATHS]...

  Validate files for data standards compliance.

  Exits with non-0 exit code if any file is not compliant.

  Validation results are automatically saved as a JSONL companion next to the
  dandi-cli log file (unless --output is used or --load is active).  Use
  ``dandi validate --load <path>`` to re-render saved results later with
  different grouping, filtering, or format options.

Options:
  -g, --grouping [none|path|severity|id|validator|standard|dandiset]
                                  How to group output. Repeat for hierarchical
                                  nesting, e.g. -g severity -g id.
  --ignore REGEX                  Regex matching error IDs to ignore
  --min-severity [INFO|HINT|WARNING|ERROR|CRITICAL]
                                  Only display issues with severities above
                                  this level.
  -f, --format [text|json|json_pp|json_lines|yaml]
                                  Output format.
  -o, --output FILE               Write output to file instead of stdout.
                                  Requires --format to be set to a structured
                                  format.
  --summary / --no-summary        Show summary statistics.
  --max-per-group INTEGER         Limit results per group (or total if
                                  ungrouped). Excess results are replaced by a
                                  count of omitted items.
  --load FILE                     Load validation results from JSONL file(s)
                                  instead of running validation.
  --help                          Show this message and exit.
❯ dandi validate -f text --load /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.09.23Z-3521473_validation.jsonl
[BIDS.NOT_INCLUDED] /home/yoh/proj/dandi/nwb/001849/dandiset.yaml — Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you should include a ".bidsignore" file in your dataset (see https://github.com/bids-standard/bids-validator#bidsignore for details). Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder.
[DANDI.BIDSIGNORE_DANDISET_YAML] /home/yoh/proj/dandi/nwb/001849/dandiset.yaml — Consider creating or updating a `.bidsignore` file in the root of your BIDS dataset to ignore `dandiset.yaml`. Add the following line to `.bidsignore`:
dandiset.yaml
[BIDS.JSON_KEY_RECOMMENDED] /home/yoh/proj/dandi/nwb/001849/dataset_description.json — A JSON file is missing a key listed as recommended.
subCode: HEDVersion
issueMessage: Field description: If HED tags are used:
The version of the HED schema used to validate HED tags for study.
May include a single schema or a base schema and one or more library schema.

[BIDS.JSON_KEY_RECOMMENDED] /home/yoh/proj/dandi/nwb/001849/dataset_description.json — A JSON file is missing a key listed as recommended.
subCode: GeneratedBy
issueMessage: Field description: Used to specify provenance of the dataset.

[BIDS.JSON_KEY_RECOMMENDED] /home/yoh/proj/dandi/nwb/001849/dataset_description.json — A JSON file is missing a key listed as recommended.
subCode: SourceDatasets
issueMessage: Field description: Used to specify the locations and relevant attributes of all source datasets (BIDS or not).
Valid keys in each object include `"URL"`, `"DOI"` (see
[URI](SPEC_ROOT/common-principles.md#uniform-resource-indicator)), and
`"Version"` with
[string](https://www.w3schools.com/js/js_json_datatypes.asp)
values.

[NWBI.check_subject_species_exists] /home/yoh/proj/dandi/nwb/001849/sourcedata/aind-sample.nwb — Subject species is missing.
2026-05-20 12:11:12,047 [    INFO] Logs saved in /home/yoh/.local/state/dandi-cli/log/2026.05.20-16.11.06Z-3527485.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions