python config_error ai_generated true

django.db.migrations.exceptions.NodeNotFoundError: Migration myapp.0002_auto depends on nonexistent node ('other_app', '0001_initial')

ID: python/pytest-django-migration-test

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2025-11-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A migration file references a dependency that doesn't exist. This can happen if the other app is not installed, the migration was deleted, or there's a circular dependency.

generic

中文

迁移文件引用了不存在的依赖项。这可能发生在其他应用未安装、迁移被删除或存在循环依赖时。

Workarounds

  1. 95% success
    Check INSTALLED_APPS and run makemigrations for missing apps.
  2. 90% success
    Edit the migration's dependencies list to reference the correct app and migration.
  3. 80% success
    python manage.py migrate --fake-initial

Dead Ends

Common approaches that don't work:

  1. 90% fail

    This may break the migration history and cause other issues.

  2. 85% fail

    This marks migrations as applied without actually creating tables, leading to database inconsistencies.

  3. 80% fail

    The app must have its migrations to satisfy the dependency.