Skip to content

Bug: object/multi-object custom fields rejected by NetBox 4.x (object gets no updates) #522

Closed

Description

@eric-eisenhart

Any device/VM carrying a populated object or multi-object custom field is PATCHed with the full serialized object representation, which NetBox 4.x rejects — and the object then receives no updates at all on any field, on every run.

Cause

The fix from #452 (5c8e54cd, "handle object and multi-object custom fields correctly") never triggers when custom fields are loaded from the NetBox API, for three reasons:

  1. The API reports the field type as a dict — {"value": "multiobject", "label": "Multiple objects"} — so grab(custom_field, "data.type") == "object" (a plain-string comparison) is always False.
  2. NetBox's actual type value for multi-object fields is multiobject (CustomFieldTypeChoices.TYPE_MULTIOBJECT), not multi-object.
  3. Only the new (incoming) custom-field values are reduced to IDs. Object custom fields that are not part of the update — e.g. one maintained by another tool — get merged into the payload from current NetBox data (new_value = {**current_value, **new_value}) and are still sent as their full serialized representation.

Impact / reproduction

Against NetBox 4.5.10 with a multi-object tenant custom field: a VM carrying that field is PATCHed and NetBox responds

{'custom_fields': ["Cannot resolve keyword 'display' into field. ..."]}

The object then receives no updates on any field, every run.

Fix

  • Normalize the dict type form to its value before comparing.
  • Accept multiobject (keep multi-object for compatibility).
  • Reduce current and new custom-field values to IDs before merging/comparing (covers fields merged in from current data, and keeps both sides comparable so unchanged object CFs stop reporting a change every run).
  • Add multiobject to the valid type list in NBCustomField.data_model.

PR to follow.

Activity

  1. semx commented on Sep 9, 2026

    @semx
    Collaborator

    Fixed in development by #524 (merged): object/multi-object custom fields are reduced to ids on both sides of the comparison and NetBox 4.x's multiobject type is accepted. Thanks @eric-eisenhart. Ships with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions