Skip to content

ERROR: InvenTree command failed: 'python3 manage.py migrate --run-syncdb' #11338

@martin323232

Description

@martin323232

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

Following blogpost, https://inventree.org/blog/2026/02/12/db-update on updating from old db.

Following error on "Step 4"

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
inven@inven:~/Downloads/InvenTree-master/docker/production$ docker compose pull
[+] Running 18/18
 ⠿ inventree-worker Skipped - Image is already being pulled by inventree-server                                                                                                                    0.0s
 ⠿ inventree-db Pulled                                                                                                                                                                            10.7s
   ⠿ 0c8d55a45c0d Already exists                                                                                                                                                                   0.0s
   ⠿ 03cf9c337134 Already exists                                                                                                                                                                   0.0s
   ⠿ d64dbdf800a2 Already exists                                                                                                                                                                   0.0s
   ⠿ 2710e764d89a Already exists                                                                                                                                                                   0.0s
   ⠿ c50a02fe2f5f Already exists                                                                                                                                                                   0.0s
   ⠿ 0ace4c983c3e Already exists                                                                                                                                                                   0.0s
   ⠿ b64f280cfa2b Already exists                                                                                                                                                                   0.0s
   ⠿ ea5e741a30ce Already exists                                                                                                                                                                   0.0s
   ⠿ 9dbecdc32213 Pull complete                                                                                                                                                                    8.6s
   ⠿ d76758f883b9 Pull complete                                                                                                                                                                    8.7s
   ⠿ 6596dc1aad70 Pull complete                                                                                                                                                                    8.7s
   ⠿ 56c3f259691b Pull complete                                                                                                                                                                    8.7s
   ⠿ 07a1bc62b3b0 Pull complete                                                                                                                                                                    8.8s
   ⠿ 8cced4a98c7e Pull complete                                                                                                                                                                    8.8s
 ⠿ inventree-server Pulled                                                                                                                                                                         1.1s
 ⠿ inventree-proxy Pulled                                                                                                                                                                          1.0s
inven@inven:~/Downloads/InvenTree-master/docker/production$ docker compose run --rm inventree-server invoke migrate
[+] Running 1/1
 ⠿ Container inventree-db  Recreated                                                                                                                                                               0.1s
[+] Running 1/1
 ⠿ Container inventree-db  Started                                                                                                                                                                 0.2s
Loading config file : /home/inventree/data/config.yaml
Running InvenTree database migrations...
INVE-W3: Could not detect git information.
Python version 3.11.13 - /usr/local/bin/python3
/root/.local/lib/python3.11/site-packages/django/core/management/commands/makemigrations.py:160: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': [Errno -3] Temporary failure in name resolution
  warnings.warn(
No changes detected
INVE-W3: Could not detect git information.
Python version 3.11.13 - /usr/local/bin/python3
INVE-W3: Could not detect git information.
Python version 3.11.13 - /usr/local/bin/python3
Traceback (most recent call last):
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 288, in ensure_connection
    self.connect()
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 269, in connect
    self.connection = self.get_new_connection(conn_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 275, in get_new_connection
    connection = self.Database.connect(**conn_params)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/psycopg/connection.py", line 98, in connect
    attempts = conninfo_attempts(params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/psycopg/_conninfo_attempts.py", line 53, in conninfo_attempts
    raise e.OperationalError(str(last_exc))
psycopg.OperationalError: [Errno -3] Temporary failure in name resolution

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

Traceback (most recent call last):
  File "/home/inventree/src/backend/InvenTree/manage.py", line 24, in <module>
    main()
  File "/home/inventree/src/backend/InvenTree/manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "/root/.local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/root/.local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/.local/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/.local/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 117, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/migrations/loader.py", line 58, in __init__
    self.build_graph()
  File "/root/.local/lib/python3.11/site-packages/django/db/migrations/loader.py", line 235, in build_graph
    self.applied_migrations = recorder.applied_migrations()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/migrations/recorder.py", line 81, in applied_migrations
    if self.has_table():
       ^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/migrations/recorder.py", line 57, in has_table
    with self.connection.cursor() as cursor:
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 329, in cursor
    return self._cursor()
           ^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 305, in _cursor
    self.ensure_connection()
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 287, in ensure_connection
    with self.wrap_database_errors:
  File "/root/.local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 288, in ensure_connection
    self.connect()
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 269, in connect
    self.connection = self.get_new_connection(conn_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 275, in get_new_connection
    connection = self.Database.connect(**conn_params)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/psycopg/connection.py", line 98, in connect
    attempts = conninfo_attempts(params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/psycopg/_conninfo_attempts.py", line 53, in conninfo_attempts
    raise e.OperationalError(str(last_exc))
django.db.utils.OperationalError: [Errno -3] Temporary failure in name resolution
ERROR: InvenTree command failed: 'python3 manage.py migrate --run-syncdb'
- Refer to the error messages in the log above for more information

Steps to Reproduce

Run docker compose run --rm inventree-server invoke migrate

Expected behaviour

No error on db migrate

Deployment Method

None

Version Information

[+] Running 1/0
 ⠿ Container inventree-db  Started                                                                                                                                                                                                                              0.0s
Loading config file : /home/inventree/data/config.yaml
INVE-W3: Could not detect git information.

InvenTree - inventree.org
The Open-Source Inventory Management System


Python paths:
Executable  /usr/local/bin/python
Environment /usr/local
Invoke Tool /usr/local/lib/python3.11/site-packages/invoke/__init__.py

Installation paths:
Base        /home/inventree
Config      /home/inventree/data/config.yaml
Plugin File /home/inventree/data/plugins.txt
Media       /home/inventree/data/media
Static      /home/inventree/data/static
Backup      /home/inventree/data/backup

Versions:
InvenTree   1.1.12
API         421
Python      3.11.13
Django      4.2.28
Node        N/A
Yarn        N/A

Environment:
Platform    Docker
Debug       False

Commit hash: aa93421
Commit date: 2026-02-12

Try to reproduce on the demo site

I did not try to reproduce

Is the bug reproducible on the demo site?

Not reproducible

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    migrationData or schema migrationsquestionThis is a questionsetupRelates to the InvenTree setup / installation process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions