Skip to content

[Bug] Adding "Instances" to TrueNAS breaks the integration with 'unsupported operand type' error #264

@unCleanCode

Description

@unCleanCode

Describe the issue

After adding "Instances" (custom docker or VM) into TrueNAS Scale, the integration fails with this error:

TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

How to reproduce the issue

Steps to reproduce the behavior:

  1. Add HA integration. Confirm all works fine
  2. Add any custom "Instance" to TrueNAS Scale
  3. Wait for HA integration to fail to fetch new data (just "unavailable")
  4. Try restarting integration - get the error from the descripion

Expected behavior

Should work, even if it'll ignore integration data

Software versions

All fields in this sections are required.

  • Home Assistant version: 2025.7.0
  • TrueNAS integration version: v1.4b4 (but I used a stable version as well)
  • TrueNAS version: Scale 25.04

Traceback/Error logs

Unexpected error fetching TrueNAS data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 382, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/coordinator.py", line 104, in _async_update_data
    await self.hass.async_add_executor_job(self.get_vm)
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/truenas/coordinator.py", line 856, in get_vm
    self.ds["vm"][uid]["memory"] = round(vals["memory"] / 1024 / 1024 / 1024)
                                         ~~~~~~~~~~~~~~~^~~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplannedTo be implemented in future release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions