3.0.6 - upgrade.sh broken, django.db.migrations.exceptions.NodeNotFoundError #5497

Closed
opened 2025-12-29 19:28:43 +01:00 by adam · 0 comments
Owner

Originally created by @JCrabtree911 on GitHub (Oct 8, 2021).

NetBox version

v3.0.6

Python version

3.7

Steps to Reproduce

Upgrading FROM 2.8.5 TO 3.0.6, everything is has been unzipped, symlinked, and copied to the appropriate place.
cd /opt/netbox
PYTHON=/usr/bin/python3.7 ./upgrade.sh

Expected Behavior

Upgrade.sh should run successfully.

Observed Behavior

The migration process throws the exception django.db.migrations.exceptions.NodeNotFoundError verbose output is below. It looks like 0131_consoleport_speed.py depends on 0130_sitegroup which doesn't exist

Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 259, in build_graph
self.graph.validate_consistency()
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 58, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0131_consoleport_speed dependencies reference nonexistent parent node ('dcim', '0130_sitegroup')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 53, in init
self.build_graph()
File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 284, in build_graph
) from exc
django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0131_consoleport_speed depends on nonexistent node ('dcim', '0130_sitegroup'). Django tried to replace migration dcim.0130_sitegroup with any of [dcim.0003_squashed_0130] but wasn't able to because some of the replaced migrations are already applied.
/opt/netbox# cd netbox/dcim/migrations/
/opt/netbox/netbox/dcim/migrations# ls
0001_squashed.py 0002_squashed.py 0003_squashed_0130.py 0131_consoleport_speed.py 0132_cable_length.py 0133_port_colors.py init.py pycache
/opt/netbox/netbox/dcim/migrations#

Originally created by @JCrabtree911 on GitHub (Oct 8, 2021). ### NetBox version v3.0.6 ### Python version 3.7 ### Steps to Reproduce Upgrading FROM 2.8.5 TO 3.0.6, everything is has been unzipped, symlinked, and copied to the appropriate place. cd /opt/netbox PYTHON=/usr/bin/python3.7 ./upgrade.sh ### Expected Behavior Upgrade.sh should run successfully. ### Observed Behavior The migration process throws the exception django.db.migrations.exceptions.NodeNotFoundError verbose output is below. It looks like 0131_consoleport_speed.py depends on 0130_sitegroup which doesn't exist Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 259, in build_graph self.graph.validate_consistency() File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in validate_consistency [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in <listcomp> [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/graph.py", line 58, in raise_error raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0131_consoleport_speed dependencies reference nonexistent parent node ('dcim', '0130_sitegroup') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 92, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 53, in __init__ self.build_graph() File "/opt/netbox-3.0.6/venv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 284, in build_graph ) from exc django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0131_consoleport_speed depends on nonexistent node ('dcim', '0130_sitegroup'). Django tried to replace migration dcim.0130_sitegroup with any of [dcim.0003_squashed_0130] but wasn't able to because some of the replaced migrations are already applied. /opt/netbox# cd netbox/dcim/migrations/ /opt/netbox/netbox/dcim/migrations# ls 0001_squashed.py 0002_squashed.py 0003_squashed_0130.py 0131_consoleport_speed.py 0132_cable_length.py 0133_port_colors.py __init__.py __pycache__ /opt/netbox/netbox/dcim/migrations#
adam added the type: bug label 2025-12-29 19:28:43 +01:00
adam closed this issue 2025-12-29 19:28:43 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5497