Skip to content

More than one root node with tree_id #12086

Description

@MichaelW-SD

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

I am getting errors like this one every few days:

Traceback (most recent call last):
File "/home/inventree/src/backend/InvenTree/InvenTree/models.py", line 940, in partial_rebuild
self.__class__.objects.partial_rebuild(tree_id)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/root/.local/lib/python3.14/site-packages/mptt/managers.py", line 46, in wrapped
return method(self, *args, **kwargs)
File "/root/.local/lib/python3.14/site-packages/mptt/managers.py", line 716, in partial_rebuild
raise RuntimeError(
...<2 lines>...
)
RuntimeError: More than one root node with tree_id 1087. That's invalid, do a full rebuild.

I am using the official docker images and do a "docker compose run --rm inventree-server invoke update" after such error. I don't know if this resolves the issue, but I couldn't find any other suggestion for how to do the rebuild.

Steps to Reproduce

This is not easily reproducible. The error appears every few days.

Expected behaviour

No error or a description for how to fix it.

Deployment Method

Docker

Version Information

1.3.3

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

2026-06-04T16:16:05.993653Z [error    ] More than one root node with tree_id 1087. That's invalid, do a full rebuild. [inventree] ip=X.X.X.X request_id=6568f1e4-e253-4fb2-ab9d-4ec33139ec75 user_id=None
2026-06-04 09:16:05,993 ERROR {'event': RuntimeError("More than one root node with tree_id 1087. That's invalid, do a full rebuild."), 'request_id': '6568f1e4-e253-4fb2-ab9d-4ec33139ec75', 'user_id': None, 'ip': 'X.X.X.X', 'timestamp': '2026-06-04T16:16:05.993653Z', 'logger': 'inventree', 'level': 'error'}
/root/.local/lib/python3.14/site-packages/django/db/models/fields/__init__.py:1612: RuntimeWarning: DateTimeField NotificationEntry.updated received a naive datetime (2026-06-03 00:00:00) while time zone support is active.
  warnings.warn(
2026-06-04T16:16:06.023275Z [error    ] Failed to rebuild tree for StockItem <None>: More than one root node with tree_id 1087. That's invalid, do a full rebuild. [inventree] ip=100.123.102.112 request_id=6568f1e4-e253-4fb2-ab9d-4ec33139ec75 user_id=None
Traceback (most recent call last):
  File "/home/inventree/src/backend/InvenTree/InvenTree/models.py", line 940, in partial_rebuild
    self.__class__.objects.partial_rebuild(tree_id)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/root/.local/lib/python3.14/site-packages/mptt/managers.py", line 46, in wrapped
    return method(self, *args, **kwargs)
  File "/root/.local/lib/python3.14/site-packages/mptt/managers.py", line 716, in partial_rebuild
    raise RuntimeError(
    ...<2 lines>...
    )
RuntimeError: More than one root node with tree_id 1087. That's invalid, do a full rebuild.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIdentifies a bug which needs to be addressedquestionThis is a question

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions