Skip to content

More than one root node with tree_id #12086

Closed as not planned
Closed as not planned

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.

Activity

  1. added
    bug
    question
    triage:not-checked
    on Jun 4, 2026
  2. SchrodingersGat commented on Jun 5, 2026

    @SchrodingersGat
    Member

    The full stock tree rebuild should happen automatically - even if you see this error.

    Can you determine if you see these error messages after performing some action in particular?

  3. removed
    triage:not-checked
    on Jun 5, 2026
  4. MichaelW-SD commented on Jun 6, 2026

    @MichaelW-SD
    Author

    I cannot identify a specific pattern. I am the only user of the system. The only stressful operation I perform is importing stock changes every morning through the python API. This generates about 600-700 api requests in about 1 minute - mainly to /api/stock and /api/part.

    | 2026-05-07 09:11 | StockItem.partial_rebuild | More than one root node with tree_id 912. That's invalid, do a full rebuild. |
    | 2026-05-09 10:31 | StockItem.partial_rebuild | More than one root node with tree_id 937. That's invalid, do a full rebuild. |
    | 2026-05-19 08:44 | StockItem.partial_rebuild | More than one root node with tree_id 1004. That's invalid, do a full rebuild. |
    | 2026-05-28 00:20 | StockItem.partial_rebuild | More than one root node with tree_id 1049. That's invalid, do a full rebuild. |
    | 2026-05-28 09:06 | StockItem.partial_rebuild | More than one root node with tree_id 1054. That's invalid, do a full rebuild. |
    | 2026-05-30 13:13 | StockItem.partial_rebuild | More than one root node with tree_id 1079. That's invalid, do a full rebuild. |
    | 2026-06-04 09:16 | StockItem.partial_rebuild | More than one root node with tree_id 1087. That's invalid, do a full rebuild. |

  5. github-actions commented on Aug 6, 2026

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  6. added
    inactive
    on Aug 6, 2026
  7. matmair commented on Aug 16, 2026

    @matmair
    Member

    I think there is not enough technical depth here to get to the botoom of this specific error instance; if anyone runs into the same issue and has more logs / dataset available: feel free to post here / open a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buginactivequestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions