Skip to content

Fails to handle removed devices when parsing models #1016

@craibo

Description

@craibo

When fetching all devices using the API the library will fail to create the model if there is a removed device in the devices response.

Error

File "/usr/local/lib/python3.13/site-packages/tailscale/tailscale.py", line 114, in devices
    return Devices.from_json(data).devices
           ~~~~~~~~~~~~~~~~~^^^^^^
  File "<string>", line 12, in __mashumaro_from_json__
mashumaro.exceptions.InvalidFieldValue: Field "devices" of type dict[str, Device] in Devices has invalid value {'xxxxxxxxx': {'addresses': ['XXX.XX.XXX.XX', 'xxxx:xxxx:xxxx::xxxx:xxxx'], 'id': 'xxxxxxxxxxx', 'nodeId': 'xxxxxxxxxxxx', 'user': 'xxxxx@xxxxxxx.com', 'name': 'xxxxxx-macbook-pro.tail53ae24.ts.net', 'hostname': 'Tims-MacBook-Pro', 'clientVersion': '1.80.2-t62b8bf6a0-g3c35ee987', 'updateAvailable': False, 'os': 'macOS', 'created': '2025-02-24T11:02:26Z', 'lastSeen': '2025-02-24T11:05:03Z', 'keyExpiryDisabled': False, 'expires': '2025-08-23T11:02:26Z', 'authorized': True, 'isExternal': False, 'machineKey': 'mkey:xxxxxxx', 'nodeKey': 'nodekey:xxxxxxxx', 'tailnetLockKey': 'nlpub:xxxxxxxxxx', 'blocksIncomingConnections': False, 'enabledRoutes': [], 'advertisedRoutes': [], 'clientConnectivity': None}}

This occurs because the field clientConnectivity has a `None' object of the device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions