Migration failed - nonexistent parent node #9647

Closed
opened 2025-12-29 21:20:15 +01:00 by adam · 4 comments
Owner

Originally created by @Mailstorm-ctrl on GitHub (May 10, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.1

Python Version

3.10

Steps to Reproduce

  1. Upgrade from 3.6.3 to 4.0.1

Expected Behavior

A successful upgrade

Observed Behavior

I get an unhandled exception.

Traceback (most recent call last):
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 276, in build_graph
    self.graph.validate_consistency()
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 60, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0183_devicetype_exclude_from_utilization dependencies reference nonexistent parent node ('dcim', '0182_zero_length_cable_fix')

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

Traceback (most recent call last):
  File "/opt/netbox-4.0.1/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 117, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 58, in __init__
    self.build_graph()
  File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 295, in build_graph
    raise NodeNotFoundError(
django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0183_devicetype_exclude_from_utilization depends on nonexistent node ('dcim', '0182_zero_length_cable_fix'). Django tried to replace migration dcim.0182_zero_length_cable_fix with any of [dcim.0167_squashed_0182] but wasn't able to because some of the replaced migrations are already applied.
Originally created by @Mailstorm-ctrl on GitHub (May 10, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.1 ### Python Version 3.10 ### Steps to Reproduce 1. Upgrade from 3.6.3 to 4.0.1 ### Expected Behavior A successful upgrade ### Observed Behavior I get an unhandled exception. ``` Traceback (most recent call last): File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 276, in build_graph self.graph.validate_consistency() File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in <listcomp> [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/graph.py", line 60, in raise_error raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0183_devicetype_exclude_from_utilization dependencies reference nonexistent parent node ('dcim', '0182_zero_length_cable_fix') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/netbox-4.0.1/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 117, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 58, in __init__ self.build_graph() File "/opt/netbox-4.0.1/venv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 295, in build_graph raise NodeNotFoundError( django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0183_devicetype_exclude_from_utilization depends on nonexistent node ('dcim', '0182_zero_length_cable_fix'). Django tried to replace migration dcim.0182_zero_length_cable_fix with any of [dcim.0167_squashed_0182] but wasn't able to because some of the replaced migrations are already applied. ```
adam closed this issue 2025-12-29 21:20:15 +01:00
Author
Owner

@arthanson commented on GitHub (May 10, 2024):

@Mailstorm-ctrl it looks like you are upgrading directly from 3.6.3 to 4? You need to first upgrade to the most recent minor release (v3.7.8) and then upgrade to v4, otherwise there can be issues. Please see (https://docs.netbox.dev/en/stable/installation/upgrading/) Please let us know if this resolves the issue.

@arthanson commented on GitHub (May 10, 2024): @Mailstorm-ctrl it looks like you are upgrading directly from 3.6.3 to 4? You need to first upgrade to the most recent minor release (v3.7.8) and then upgrade to v4, otherwise there can be issues. Please see (https://docs.netbox.dev/en/stable/installation/upgrading/) Please let us know if this resolves the issue.
Author
Owner

@Mailstorm-ctrl commented on GitHub (May 10, 2024):

Oh my...my eyes are failing me. I thought all the 3.7's were 3.6...🙈

@Mailstorm-ctrl commented on GitHub (May 10, 2024): Oh my...my eyes are failing me. I thought all the 3.7's were 3.6...🙈
Author
Owner

@Mailstorm-ctrl commented on GitHub (May 10, 2024):

So I got upgraded to 4.0.1 withouth migration issues but now I'm pretty confused on what happened with my install.

When I first set netbox up I did logging for LDAP because it wasn't working. I guess I never turned it off (oops). When I now start the netbox service see the following error:

Traceback (most recent call last):
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/config.py", line 565, in configure
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     handler = self.configure_handler(handlers[name])
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/config.py", line 746, in configure_handler
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     result = factory(**kwargs)
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/handlers.py", line 155, in __init__
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/handlers.py", line 58, in __init__
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     logging.FileHandler.__init__(self, filename, mode=mode,
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/__init__.py", line 1169, in __init__
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     StreamHandler.__init__(self, self._open())
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/usr/lib/python3.10/logging/__init__.py", line 1201, in _open
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     return open_func(self.baseFilename, self.mode,
Aug 30 20:50:31 fppnetbox gunicorn[18594]: FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox/local/logs/django-ldap-debug.log'
Aug 30 20:50:31 fppnetbox gunicorn[18594]: The above exception was the direct cause of the following exception:
Aug 30 20:50:31 fppnetbox gunicorn[18594]: Traceback (most recent call last):
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     worker.init_process()
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 95, in init_process
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     super().init_process()
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     self.load_wsgi()
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     self.wsgi = self.app.wsgi()
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
Aug 30 20:50:31 fppnetbox gunicorn[18594]:     self.callable = self.load()
Aug 30 20:50:31 fppnetbox gunicorn[18594]:   File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load

I thought I could just make the file and it'd be dandie but it's still acting like it isn't there. And what's really confusing me is why the traceback is referring to netbox 3.6.0

@Mailstorm-ctrl commented on GitHub (May 10, 2024): So I got upgraded to 4.0.1 withouth migration issues but now I'm pretty confused on what happened with my install. When I first set netbox up I did logging for LDAP because it wasn't working. I guess I never turned it off (oops). When I now start the netbox service see the following error: ``` Traceback (most recent call last): Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/config.py", line 565, in configure Aug 30 20:50:31 fppnetbox gunicorn[18594]: handler = self.configure_handler(handlers[name]) Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/config.py", line 746, in configure_handler Aug 30 20:50:31 fppnetbox gunicorn[18594]: result = factory(**kwargs) Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/handlers.py", line 155, in __init__ Aug 30 20:50:31 fppnetbox gunicorn[18594]: BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding, Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/handlers.py", line 58, in __init__ Aug 30 20:50:31 fppnetbox gunicorn[18594]: logging.FileHandler.__init__(self, filename, mode=mode, Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/__init__.py", line 1169, in __init__ Aug 30 20:50:31 fppnetbox gunicorn[18594]: StreamHandler.__init__(self, self._open()) Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/usr/lib/python3.10/logging/__init__.py", line 1201, in _open Aug 30 20:50:31 fppnetbox gunicorn[18594]: return open_func(self.baseFilename, self.mode, Aug 30 20:50:31 fppnetbox gunicorn[18594]: FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox/local/logs/django-ldap-debug.log' Aug 30 20:50:31 fppnetbox gunicorn[18594]: The above exception was the direct cause of the following exception: Aug 30 20:50:31 fppnetbox gunicorn[18594]: Traceback (most recent call last): Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker Aug 30 20:50:31 fppnetbox gunicorn[18594]: worker.init_process() Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 95, in init_process Aug 30 20:50:31 fppnetbox gunicorn[18594]: super().init_process() Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process Aug 30 20:50:31 fppnetbox gunicorn[18594]: self.load_wsgi() Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi Aug 30 20:50:31 fppnetbox gunicorn[18594]: self.wsgi = self.app.wsgi() Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi Aug 30 20:50:31 fppnetbox gunicorn[18594]: self.callable = self.load() Aug 30 20:50:31 fppnetbox gunicorn[18594]: File "/opt/netbox-3.6.0/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load ``` I thought I could just make the file and it'd be dandie but it's still acting like it isn't there. And what's really confusing me is why the traceback is referring to netbox 3.6.0
Author
Owner

@Mailstorm-ctrl commented on GitHub (May 10, 2024):

And for some reason I failed to copy the gunicorn file to the new install. DOing that seems to have fixed it for some reason

@Mailstorm-ctrl commented on GitHub (May 10, 2024): And for some reason I failed to copy the gunicorn file to the new install. DOing that seems to have fixed it for some reason
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9647