Skip to content

CI failure: TypeError writing image/ophys types with uint64 data (DatasetBuilder rejects numpy.uint64 scalar) #2193

@rly

Description

@rly

Description

All roundtrip integration tests for image and ophys types are failing across all platforms and Python versions on dev with:

TypeError: DatasetBuilder.__init__: incorrect type for 'data' (got 'uint64', expected
'ndarray, list, tuple, Dataset, StrDataset, HDMFDataset, AbstractDataChunkIterator,
str, int, float, bytes, bool, datetime, date, DataIO, DatasetBuilder, Iterable,
datetime or date')

The error occurs during write (building the DatasetBuilder), not during read.

Affected tests

All failing in tests/integration/hdf5/:

  • test_image.TestImageSeriesIO (roundtrip, roundtrip_export)
  • test_image.TestOpticalSeriesIO (roundtrip, roundtrip_export)
  • test_image.TestOpticalSeriesOptionalFieldsIO (roundtrip, roundtrip_export)
  • test_ophys.MaskIO (roundtrip, roundtrip_export)
  • test_ophys.TestCorrectedImageStackIO (roundtrip, roundtrip_export)
  • test_ophys.TestImageMaskIO (roundtrip, roundtrip_export)
  • test_ophys.TestMotionCorrection (roundtrip, roundtrip_export)
  • test_ophys.TestOnePhotonSeriesIO (roundtrip, roundtrip_export)
  • And more (24 errors total)

All platforms (ubuntu, macos, windows) and Python versions (3.10, 3.14) affected.

Root cause

A numpy.uint64 scalar is being passed as data to DatasetBuilder.__init__, which HDMF's docval rejects because numpy scalar types are not in its accepted types list. This is likely a regression from an HDMF update — numpy scalar types such as numpy.uint64 may have previously been accepted (e.g., via the int check or an Iterable fallback) but are now being rejected.

Example traceback

File "pynwb/testing/testh5io.py", line 97, in roundtripContainer
    write_io.write(nwbfile, cache_spec=cache_spec)
File "hdmf/backends/hdf5/h5tools.py", line 328, in write
    super().write(**kwargs)
File "hdmf/backends/io.py", line 92, in write
    f_builder = self.__manager.build(container, source=self.__source, root=True)
...
TypeError: DatasetBuilder.__init__: incorrect type for 'data' (got 'uint64', ...)

Fix

Either:

  1. Identify where a numpy.uint64 scalar is being set on an image/ophys container in pynwb and cast it to a supported type (e.g., int), or
  2. File upstream in hdmf-dev/hdmf to accept numpy scalar types in DatasetBuilder.

Seen on CI run: https://github.com/NeurodataWithoutBorders/pynwb/actions/runs/25932538893

Metadata

Metadata

Assignees

No one assigned

    Labels

    category: bugerrors in the code or code behaviorpriority: highimpacts proper operation or use of feature important to most users

    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