Error updating via .git from version 4.1.11 to 4.2.0 #10636

Closed
opened 2025-12-29 21:33:59 +01:00 by adam · 11 comments
Owner

Originally created by @tamoratti on GitHub (Jan 9, 2025).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.11

Python Version

3.11

Steps to Reproduce

  1. git checkout v4.1.11

  2. ./upgrade.sh

Expected Behavior

Installation completed successfully.

Observed Behavior

File "/opt/netbox/netbox/netbox/filtersets.py", line 183, in get_additional_lookups
raise ValueError('Invalid field name/lookup on {}: {}'.format(existing_filter_name, field_name))
ValueError: Invalid field name/lookup on mac_address: interfaces__mac_address

Originally created by @tamoratti on GitHub (Jan 9, 2025). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.11 ### Python Version 3.11 ### Steps to Reproduce 1. git checkout v4.1.11 2. ./upgrade.sh ### Expected Behavior Installation completed successfully. ### Observed Behavior File "/opt/netbox/netbox/netbox/filtersets.py", line 183, in get_additional_lookups raise ValueError('Invalid field name/lookup on {}: {}'.format(existing_filter_name, field_name)) ValueError: Invalid field name/lookup on mac_address: interfaces__mac_address
adam closed this issue 2025-12-29 21:33:59 +01:00
Author
Owner

@jvanhambelgium commented on GitHub (Jan 9, 2025):

Exactly the same issue here when I tried.
Ubuntu 24.04.01 , Netbox 4.1.7

...
netboxadmin@netbox-dev:/opt/netbox$ sudo ./upgrade.sh
You are installing (or upgrading to) NetBox version 4.2.1
Using Python 3.12.3

Removing old virtual environment...
Creating a new virtual environment at /opt/netbox/venv...
Updating pip (pip install --upgrade pip)...
Requirement already satisfied: pip in ./venv/lib/python3.12/site-packages (24.0)
Collecting pip
....

Skipping local dependencies (local_requirements.txt not found)
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
...
...
...
...(a lot of output)
...
File "/opt/netbox/netbox/netbox/filtersets.py", line 231, in get_filters
additional_filters.update(cls.get_additional_lookups(existing_filter_name, existing_filter))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/filtersets.py", line 183, in get_additional_lookups
raise ValueError('Invalid field name/lookup on {}: {}'.format(existing_filter_name, field_name))
ValueError: Invalid field name/lookup on mac_address: interfaces__mac_address

@jvanhambelgium commented on GitHub (Jan 9, 2025): Exactly the same issue here when I tried. **Ubuntu 24.04.01 , Netbox 4.1.7** ... netboxadmin@netbox-dev:/opt/netbox$ sudo ./upgrade.sh **You are installing (or upgrading to) NetBox version 4.2.1 Using Python 3.12.3** Removing old virtual environment... Creating a new virtual environment at /opt/netbox/venv... Updating pip (pip install --upgrade pip)... Requirement already satisfied: pip in ./venv/lib/python3.12/site-packages (24.0) Collecting pip .... Skipping local dependencies (local_requirements.txt not found) Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() ... ... ... ...(a lot of output) ... File "/opt/netbox/netbox/netbox/filtersets.py", line 231, in get_filters additional_filters.update(cls.get_additional_lookups(existing_filter_name, existing_filter)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/filtersets.py", line 183, in get_additional_lookups raise ValueError('Invalid field name/lookup on {}: {}'.format(existing_filter_name, field_name)) **ValueError: Invalid field name/lookup on mac_address: interfaces__mac_address**
Author
Owner

@jeremystretch commented on GitHub (Jan 9, 2025):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Jan 9, 2025): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@jvanhambelgium commented on GitHub (Jan 9, 2025):

Hi Jeremy,
It is the actual upgrade that goes wrong, so starting from a vanilla empty Netbox install has no value.
Let's wait & see if some other are affected too.

empty NetBox installation to reproduce the exact problem you're experiencing.

The actual error :
ValueError: Invalid field name/lookup on mac_address: interfaces__mac_address

is this correct ? should it not be interfaces_mac_address in stead of interfaces__mac_address ?
I'm not a developer or coder, just thinking out loud.
I have 1 "custom field" created which happens to also be something MAC-address related.

Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description
mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address

@jvanhambelgium commented on GitHub (Jan 9, 2025): Hi Jeremy, It is the actual upgrade that goes wrong, so starting from a vanilla empty Netbox install has no value. Let's wait & see if some other are affected too. > empty NetBox installation to reproduce the exact problem you're experiencing. The actual error : ValueError: Invalid field name/lookup on mac_address: interface**s__m**ac_address is this correct ? should it not be interfaces_mac_address in stead of interfaces__mac_address ? I'm not a developer or coder, just thinking out loud. I have 1 "custom field" created which happens to also be something MAC-address related. Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address
Author
Owner

@sleepinggenius2 commented on GitHub (Jan 9, 2025):

I have upgraded with git from both a 3.7.8 and 4.1.11 install to 4.2.1 without any issues. The part of the stack trace that you included doesn't provide enough context to see where the issue is actually occurring, so providing more of that could be helpful. The lookup interfaces__mac_address would have been correct prior to the introduction of the MAC address model in 4.2, but would need to be updated to interfaces__primary_mac_address or interfaces__mac_addresses now, depending on which makes more sense in your context. Do you have any plugins installed? All the filtersets in the core product have been updated appropriately.

@sleepinggenius2 commented on GitHub (Jan 9, 2025): I have upgraded with git from both a 3.7.8 and 4.1.11 install to 4.2.1 without any issues. The part of the stack trace that you included doesn't provide enough context to see where the issue is actually occurring, so providing more of that could be helpful. The lookup `interfaces__mac_address` would have been correct prior to the introduction of the MAC address model in 4.2, but would need to be updated to `interfaces__primary_mac_address` or `interfaces__mac_addresses` now, depending on which makes more sense in your context. Do you have any plugins installed? All the filtersets in the core product have been updated appropriately.
Author
Owner

@jvanhambelgium commented on GitHub (Jan 9, 2025):

SOLVED

-> I've created another clone of my prod-vm to play on
-> First I removed my "custom field" called "mac"

Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description
mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address

-> Only then I started the documented upgrade procedure, sourcing from git.
-> Executed the ./upgrade.sh and watched ...

-> Suddenly I got an error on my plugin "topology-views" which I never had on my previous upgrade-attempt!
https://github.com/netbox-community/netbox-topology-views

-> I removed all references from the /opt/netbox/netbox/netbox/confgiuration.py concerning this PLUGING
-> Executed the ./upgrade.sh again...

...lo and behold...it continues...

Operations to perform:
Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless
Running migrations:
Applying extras.0122_charfield_null_choices... OK
Applying tenancy.0016_charfield_null_choices... OK
Applying ipam.0071_prefix_scope... OK
Applying dcim.0192_inventoryitem_status... OK
Applying dcim.0193_poweroutlet_color... OK
Applying ipam.0072_prefix_cached_relations... OK
Applying ipam.0073_charfield_null_choices... OK
Applying ipam.0074_vlantranslationpolicy_vlantranslationrule... OK
Applying ipam.0075_vlan_qinq... OK
Applying dcim.0194_charfield_null_choices... OK
Applying dcim.0195_interface_vlan_translation_policy... OK
Applying dcim.0196_qinq_svlan... OK
Applying dcim.0197_natural_sort_collation... OK
Applying circuits.0045_circuit_distance... OK
Applying circuits.0046_charfield_null_choices... OK
Applying circuits.0047_circuittermination__termination... OK
Applying circuits.0048_circuitterminations_cached_relations... OK
Applying circuits.0049_natural_ordering... OK
Applying circuits.0050_virtual_circuits... OK
Applying circuits.0051_virtualcircuit_group_assignment... OK
Applying dcim.0198_natural_ordering... OK
Applying dcim.0199_macaddress... OK
Applying dcim.0200_populate_mac_addresses... OK
Applying ipam.0076_natural_ordering... OK
Applying tenancy.0017_natural_ordering... OK
Applying virtualization.0041_charfield_null_choices... OK
Applying virtualization.0042_vminterface_vlan_translation_policy... OK
Applying virtualization.0043_qinq_svlan... OK
Applying virtualization.0044_cluster_scope... OK
Applying virtualization.0045_clusters_cached_relations... OK
Applying virtualization.0046_alter_cluster__location_alter_cluster__region_and_more... OK
Applying virtualization.0047_natural_ordering... OK
Applying virtualization.0048_populate_mac_addresses... OK
Applying vpn.0006_charfield_null_choices... OK
Applying vpn.0007_natural_ordering... OK
Applying wireless.0010_charfield_null_choices... OK
Applying wireless.0011_wirelesslan__location_wirelesslan__region_and_more... OK
Applying wireless.0012_alter_wirelesslan__location_and_more... OK
Applying wireless.0013_natural_ordering... OK
Checking for missing cable paths (python3 netbox/manage.py trace_paths --no-input)...
Found no missing console port paths; skipping
Found no missing console server port paths; skipping
Found no missing interface paths; skipping
Found no missing power feed paths; skipping
Found no missing power outlet paths; skipping
Found no missing power port paths; skipping
Finished.

All good now!

So there is certainly something when you have some "custom fields" created ? For reference, I only removed 1 (out of 2) custom fields -> the one regarding to "mac addresses"

Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description
mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address

At time of upgrade, 1 custom-field was stil present but this is created inside another part of the datamodel ("dcim" and not "ipam")

Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description
milestone_id,dcim.device,Milestone-ID,,Integer,False,True,Camera-ID inside Milestone CMS

@jvanhambelgium commented on GitHub (Jan 9, 2025): **SOLVED** -> I've created another clone of my prod-vm to play on -> First I removed my "custom field" called "mac" Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address -> Only then I started the documented upgrade procedure, sourcing from git. -> Executed the ./upgrade.sh and watched ... -> Suddenly I got an error on my plugin "topology-views" which I never had on my previous upgrade-attempt! https://github.com/netbox-community/netbox-topology-views -> I removed all references from the /opt/netbox/netbox/netbox/confgiuration.py concerning this PLUGING -> Executed the ./upgrade.sh again... ...lo and behold...it continues... Operations to perform: Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless Running migrations: Applying extras.0122_charfield_null_choices... OK Applying tenancy.0016_charfield_null_choices... OK Applying ipam.0071_prefix_scope... OK Applying dcim.0192_inventoryitem_status... OK Applying dcim.0193_poweroutlet_color... OK Applying ipam.0072_prefix_cached_relations... OK Applying ipam.0073_charfield_null_choices... OK Applying ipam.0074_vlantranslationpolicy_vlantranslationrule... OK Applying ipam.0075_vlan_qinq... OK Applying dcim.0194_charfield_null_choices... OK Applying dcim.0195_interface_vlan_translation_policy... OK Applying dcim.0196_qinq_svlan... OK Applying dcim.0197_natural_sort_collation... OK Applying circuits.0045_circuit_distance... OK Applying circuits.0046_charfield_null_choices... OK Applying circuits.0047_circuittermination__termination... OK Applying circuits.0048_circuitterminations_cached_relations... OK Applying circuits.0049_natural_ordering... OK Applying circuits.0050_virtual_circuits... OK Applying circuits.0051_virtualcircuit_group_assignment... OK Applying dcim.0198_natural_ordering... OK Applying dcim.0199_macaddress... OK Applying dcim.0200_populate_mac_addresses... OK Applying ipam.0076_natural_ordering... OK Applying tenancy.0017_natural_ordering... OK Applying virtualization.0041_charfield_null_choices... OK Applying virtualization.0042_vminterface_vlan_translation_policy... OK Applying virtualization.0043_qinq_svlan... OK Applying virtualization.0044_cluster_scope... OK Applying virtualization.0045_clusters_cached_relations... OK Applying virtualization.0046_alter_cluster__location_alter_cluster__region_and_more... OK Applying virtualization.0047_natural_ordering... OK Applying virtualization.0048_populate_mac_addresses... OK Applying vpn.0006_charfield_null_choices... OK Applying vpn.0007_natural_ordering... OK Applying wireless.0010_charfield_null_choices... OK Applying wireless.0011_wirelesslan__location_wirelesslan__region_and_more... OK Applying wireless.0012_alter_wirelesslan__location_and_more... OK Applying wireless.0013_natural_ordering... OK Checking for missing cable paths (python3 netbox/manage.py trace_paths --no-input)... Found no missing console port paths; skipping Found no missing console server port paths; skipping Found no missing interface paths; skipping Found no missing power feed paths; skipping Found no missing power outlet paths; skipping Found no missing power port paths; skipping Finished. **All good now!** So there is certainly something when you have some "custom fields" created ? For reference, I only removed 1 (out of 2) custom fields -> the one regarding to "mac addresses" Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description mac,ipam.ipaddress,MAC Address,,Text,False,True,MAC Address At time of upgrade, 1 custom-field was stil present but this is created inside another part of the datamodel ("dcim" and not "ipam") Name,Object Types,Label,Group name,Type,Required,Validate Uniqueness,Description milestone_id,dcim.device,Milestone-ID,,Integer,False,True,Camera-ID inside Milestone CMS
Author
Owner

@sleepinggenius2 commented on GitHub (Jan 9, 2025):

I suspect that the custom field was a red herring and the issue was just the plugin all along, as we have dozens of custom fields in our environment, including one almost identical to yours. You might try another cloned upgrade without removing the custom field and see if it's still working.

@sleepinggenius2 commented on GitHub (Jan 9, 2025): I suspect that the custom field was a red herring and the issue was just the plugin all along, as we have dozens of custom fields in our environment, including one almost identical to yours. You might try another cloned upgrade without removing the custom field and see if it's still working.
Author
Owner

@smwinn commented on GitHub (Jan 9, 2025):

Removing the netbox-topology-views plugin fixed the above error in my instance. It seems that many of the plugins are not compatible with 4.2.x yet. Only one of the four plugins I had installed will work with the current version.

@smwinn commented on GitHub (Jan 9, 2025): Removing the netbox-topology-views plugin fixed the above error in my instance. It seems that many of the plugins are not compatible with 4.2.x yet. Only one of the four plugins I had installed will work with the current version.
Author
Owner

@jvanhambelgium commented on GitHub (Jan 9, 2025):

I suspect that the custom field was a red herring and the issue was just the plugin all along, as we have dozens of custom fields in our environment, including one almost identical to yours. You might try another cloned upgrade without removing the custom field and see if it's still working.

Your suspicion was spot on!
I've retried on a fresh clone, now only disabling the topology-view plugin.
No errors, upgrade was a first-time-right!

@jvanhambelgium commented on GitHub (Jan 9, 2025): > I suspect that the custom field was a red herring and the issue was just the plugin all along, as we have dozens of custom fields in our environment, including one almost identical to yours. You might try another cloned upgrade without removing the custom field and see if it's still working. **Your suspicion was spot on!** I've retried on a fresh clone, now only disabling the topology-view plugin. No errors, upgrade was a first-time-right!
Author
Owner

@tamoratti commented on GitHub (Jan 10, 2025):

Problem resolved.

After removing the topology_views plugin, the update was completed without issues.

Upgrade complete! Don't forget to restart the NetBox services:

@tamoratti commented on GitHub (Jan 10, 2025): Problem resolved. After removing the topology_views plugin, the update was completed without issues. Upgrade complete! Don't forget to restart the NetBox services:
Author
Owner

@mattieserver commented on GitHub (Jan 10, 2025):

The topology views plugin has been updated to support v4.2, so it can be enabled again.
Other users should not have this issue if they update now since the upgrade script would also update the plugin.

@mattieserver commented on GitHub (Jan 10, 2025): The topology views plugin has been updated to support v4.2, so it can be enabled again. Other users should not have this issue if they update now since the upgrade script would also update the plugin.
Author
Owner

@jeremystretch commented on GitHub (Jan 17, 2025):

I'm going to close this out as it does not appear any further action is needed.

@jeremystretch commented on GitHub (Jan 17, 2025): I'm going to close this out as it does not appear any further action is needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10636