Opened 4 years ago

Closed 4 years ago

#23021 closed Bug (duplicate)

Cannot migrate: KeyError: u"Dependency references nonexistent parent node (u'contenttypes', u'__last__')"

Reported by: artscoop Owned by: nobody
Component: Migrations Version: 1.7-rc-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Hello all,
I found a migration bug I cannot resolve. I wanted to create an initial migration for an app.
I called "makemigrations content". Everything ok (was broken in 1.7 RC1 but fixed in stable/1.7.x).
Then I tried to "migrate content --fake". Here's the whole output:

    Traceback (most recent call last):
      File "/home/artscoop/virtualenv/project/one/", line 8, in <module>
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/", line 385, in execute_from_command_line
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/", line 377, in execute
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/", line 288, in run_from_argv
        self.execute(*args, **options.__dict__)
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/", line 337, in execute
        output = self.handle(*args, **options)
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/core/management/commands/", line 63, in handle
        executor = MigrationExecutor(connection, self.migration_progress_callback)
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/", line 16, in __init__
        self.loader = MigrationLoader(self.connection)
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/", line 48, in __init__
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/", line 241, in build_graph
        self.graph.add_dependency(key, parent)
      File "/home/artscoop/virtualenv/project/local/lib/python2.7/site-packages/django/db/migrations/", line 42, in add_dependency
        raise KeyError("Dependency references nonexistent parent node %r" % (parent,))
    KeyError: u"Dependency references nonexistent parent node (u'contenttypes', u'__last__')"

On 13 models, 4 have a generic foreign key (a "contenttypes.ContentType" foreign key).

Change History (1)

comment:1 Changed 4 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

Seems like a duplicate of #23008.

Note: See TracTickets for help on using tickets.
Back to Top