Failed to extract metadata: Indexing elements must be in increasing order

Đang mở
#1,864 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu trong dandi/pynwb_utils.py tại _get_session_duration(), đặc biệt là dòng được chỉ ra trong traceback, và tái hiện lỗi với tệp NWB được nêu bằng dandi upload. So sánh dữ liệu thời gian phiên của tệp này với dữ liệu của hai tệp tải lên thành công. Hoàn tất khi việc trích xuất siêu dữ liệu và tải lên không còn thất bại đối với tệp này, đồng thời có coverage cho trường hợp được báo cáo nếu xác định được vị trí test hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hello,

I've made some nwb files and am trying to upload them to DANDI using dandi upload. I have three of them. Two upload just fine. The other one hits this error trace:

2026-05-28T16:06:11+0100 [WARNING ] dandi 923713:127939540670144 Failed to extract NWB metadata from /home/nolanlab/fromgit/nolanlab_nwb/001854/sub-M22/sub-M22_ses-D34OF2_ecephys+behavior.nwb: TypeError: Indexing elements must be in increasing order
2026-05-28T16:06:11+0100 [ERROR   ] dandi 923713:127939540670144 Error uploading /home/nolanlab/fromgit/nolanlab_nwb/001854/sub-M22/sub-M22_ses-D34OF2_ecephys+behavior.nwb:
Traceback (most recent call last):
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/upload.py", line 392, in process_path
    metadata = dfile.get_metadata(
               ~~~~~~~~~~~~~~~~~~^
        digest=file_etag, ignore_errors=allow_any_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ).model_dump(mode="json", exclude_none=True)
    ^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/files/bases.py", line 494, in get_metadata
    metadata = nwb2asset(self.filepath, digest=digest)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/metadata/nwb.py", line 149, in nwb2asset
    metadata = get_metadata(nwb_path)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/fscacher/cache.py", line 164, in fingerprinter
    ret = fingerprinted(*args, **kwargs_)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 607, in __call__
    return self._cached_call(args, kwargs, shelving=False)[0]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 562, in _cached_call
    return self._call(call_id, args, kwargs, shelving)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 832, in _call
    output = self.func(*args, **kwargs)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/fscacher/cache.py", line 100, in fingerprinted
    return f(path, *args, **kwargs)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/metadata/nwb.py", line 106, in get_metadata
    meta.update(_get_pynwb_metadata(r))
                ~~~~~~~~~~~~~~~~~~~^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/pynwb_utils.py", line 279, in _get_pynwb_metadata
    session_duration = _get_session_duration(nwb)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/pynwb_utils.py", line 350, in _get_session_duration
    start = float(np.min(np.r_[st_data[0], st_data[idxs[:-1]]]))
                                           ~~~~~~~^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/container.py", line 1002, in __getitem__
    return self.get(args)
           ~~~~~~~~^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/common/table.py", line 61, in get
    return super().get(key)
           ~~~~~~~~~~~^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/container.py", line 1010, in get
    return self.data[args]
           ~~~~~~~~~^^^^^^
  File "h5py/_objects.pyx", line 56, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 57, in h5py._objects.with_phil.wrapper
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/h5py/_hl/dataset.py", line 893, in __getitem__
    selection = sel.select(self.shape, args, dataset=self)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/h5py/_hl/selections.py", line 82, in select
    return selector.make_selection(args)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "h5py/_selector.pyx", line 282, in h5py._selector.Selector.make_selection
  File "h5py/_selector.pyx", line 215, in h5py._selector.Selector.apply_args
TypeError: Indexing elements must be in increasing order

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/upload.py", line 396, in process_path
    raise UploadError("failed to extract metadata: %s" % str(e))
dandi.exceptions.UploadError: failed to extract metadata: Indexing elements must be in increasing order
2026-05-28T16:06:11+0100 [DEBUG   ] urllib3.connectionpool 923713:127941258118976 Starting new HTTPS connection (1): rig.mit.edu:443
2026-05-28T16:06:16+0100 [DEBUG   ] dandi 923713:127941258118976 Caught exception failed to extract metadata: Indexing elements must be in increasing order
Traceback (most recent call last):
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/upload.py", line 392, in process_path
    metadata = dfile.get_metadata(
               ~~~~~~~~~~~~~~~~~~^
        digest=file_etag, ignore_errors=allow_any_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ).model_dump(mode="json", exclude_none=True)
    ^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/files/bases.py", line 494, in get_metadata
    metadata = nwb2asset(self.filepath, digest=digest)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/metadata/nwb.py", line 149, in nwb2asset
    metadata = get_metadata(nwb_path)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/fscacher/cache.py", line 164, in fingerprinter
    ret = fingerprinted(*args, **kwargs_)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 607, in __call__
    return self._cached_call(args, kwargs, shelving=False)[0]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 562, in _cached_call
    return self._call(call_id, args, kwargs, shelving)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/joblib/memory.py", line 832, in _call
    output = self.func(*args, **kwargs)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/fscacher/cache.py", line 100, in fingerprinted
    return f(path, *args, **kwargs)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/metadata/nwb.py", line 106, in get_metadata
    meta.update(_get_pynwb_metadata(r))
                ~~~~~~~~~~~~~~~~~~~^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/pynwb_utils.py", line 279, in _get_pynwb_metadata
    session_duration = _get_session_duration(nwb)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/pynwb_utils.py", line 350, in _get_session_duration
    start = float(np.min(np.r_[st_data[0], st_data[idxs[:-1]]]))
                                           ~~~~~~~^^^^^^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/container.py", line 1002, in __getitem__
    return self.get(args)
           ~~~~~~~~^^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/common/table.py", line 61, in get
    return super().get(key)
           ~~~~~~~~~~~^^^^^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/hdmf/container.py", line 1010, in get
    return self.data[args]
           ~~~~~~~~~^^^^^^
  File "h5py/_objects.pyx", line 56, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 57, in h5py._objects.with_phil.wrapper
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/h5py/_hl/dataset.py", line 893, in __getitem__
    selection = sel.select(self.shape, args, dataset=self)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/h5py/_hl/selections.py", line 82, in select
    return selector.make_selection(args)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "h5py/_selector.pyx", line 282, in h5py._selector.Selector.make_selection
  File "h5py/_selector.pyx", line 215, in h5py._selector.Selector.apply_args
TypeError: Indexing elements must be in increasing order

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/cli/base.py", line 126, in wrapper
    return f(*args, **kwargs)
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/cli/cmd_upload.py", line 113, in upload
    upload_(
    ~~~~~~~^
        paths,
        ^^^^^^
    ...<9 lines>...
        validation_log_path=companion,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/upload.py", line 505, in upload
    raise upload_err
  File "/home/nolanlab/fromgit/nolanlab_nwb/.venv/lib/python3.13/site-packages/dandi/upload.py", line 396, in process_path
    raise UploadError("failed to extract metadata: %s" % str(e))
dandi.exceptions.UploadError: failed to extract metadata: Indexing elements must be in increasing order

I don't know what this means, or how to proceed.

Strange things:

  • dandi validate runs fine.
  • the metadata is generated in the same way for all nwb files, so I don' t understand why only one of them would fail.
  • When I open the nwb file using pynwb, it looks fine and all the metadata looks reasonable.

Any advice very welcome!

Ngôn ngữ chính
Python
Star
28
Fork
37
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dandi/dandi-cli

Tất cả issue của dandi/dandi-cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.