Skip to content

[Bug]: Recursion limit reached when displaying "All units" #12813

Closed

Description

@CraigBurden

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

Internal server issue, hitting recursion limit, when trying to display "All units" on the custom units page of the admin center

Steps to Reproduce

Open the Custom units tab
Click to expand the all units fold

Expected behaviour

It unfolds and displays the list

Deployment Method

Docker

Version Information

InvenTree-Version: 1.5.2
Django Version: 5.2.16
Commit Hash: f15e35c
Commit Date: 2026-08-25
Commit Branch: null
Database: django.db.backends.postgresql
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-6.12.105+deb13-cloud-amd64-x86_64-with-glibc2.41
Installer: DOC
Active plugins: [{"name":"InvenTreeBarcode","slug":"inventreebarcode","version":"2.2.0"},{"name":"BOM Exporter","slug":"bom-exporter","version":"1.1.0"},{"name":"InvenTree Exporter","slug":"inventree-exporter","version":"1.0.0"},{"name":"Parameter Exporter","slug":"parameter-exporter","version":"2.0.0"},{"name":"InvenTreeEmailNotifications","slug":"inventree-email-notification","version":"1.0.0"},{"name":"InvenTreeUINotifications","slug":"inventree-ui-notification","version":"1.0.0"},{"name":"InvenTreeCurrencyExchange","slug":"inventreecurrencyexchange","version":"1.0.0"},{"name":"InvenTreeMachines","slug":"inventree-machines","version":"1.0.0"},{"name":"InvenTreeLabel","slug":"inventreelabel","version":"1.1.0"},{"name":"InvenTreeLabelMachine","slug":"inventreelabelmachine","version":"1.0.0"},{"name":"PartChangeLog","slug":"partchangelog","version":"1.0.17"},{"name":"IPNGenerator","slug":"ipngen","version":"0.4.0"}]

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

Traceback (most recent call last):

  File "/root/.local/lib/python3.14/site-packages/rest_framework/views.py", line 512, in dispatch
    response = handler(request, *args, **kwargs)

  File "/home/inventree/src/backend/InvenTree/common/api.py", line 564, in all
    all_units = {k: self.get_unit(reg, k) for k in reg}
                    ~~~~~~~~~~~~~^^^^^^^^

  File "/home/inventree/src/backend/InvenTree/common/api.py", line 580, in get_unit
    'compatible_units': [str(a) for a in unit.compatible_units()],  # ty:ignore[missing-argument]
                                         ~~~~~~~~~~~~~~~~~~~~~^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/unit.py", line 104, in compatible_units
    return self._REGISTRY.get_compatible_units(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/system/registry.py", line 237, in get_compatible_units
    equiv = self._get_compatible_units(input_units, group_or_system)

  File "/root/.local/lib/python3.14/site-packages/pint/facets/system/registry.py", line 247, in _get_compatible_units
    return frozenset(members & super()._get_compatible_units(input_units))
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/group/registry.py", line 139, in _get_compatible_units
    ret = super()._get_compatible_units(input_units)

  File "/root/.local/lib/python3.14/site-packages/pint/facets/context/registry.py", line 415, in _get_compatible_units
    src_dim = self._get_dimensionality(input_units)

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/registry.py", line 738, in _get_dimensionality
    self._get_dimensionality_recurse(input_units, 1, accumulator)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/registry.py", line 770, in _get_dimensionality_recurse
    self._get_dimensionality_recurse(reg.reference, exp2, accumulator)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/registry.py", line 770, in _get_dimensionality_recurse
    self._get_dimensionality_recurse(reg.reference, exp2, accumulator)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/registry.py", line 770, in _get_dimensionality_recurse
    self._get_dimensionality_recurse(reg.reference, exp2, accumulator)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  [Previous line repeated 926 more times]

  File "/root/.local/lib/python3.14/site-packages/pint/facets/plain/registry.py", line 752, in _get_dimensionality_recurse
    for key in ref:
               ^^^

RecursionError: maximum recursion depth exceeded

I have reviewed this report for correctness and filled out all sections.

  • I have checked this report. I acknowledge that filing bugs via AI agents without review might lead to being blocked.

Activity

  1. added
    bug
    question
    triage:not-checked
    on Sep 7, 2026
  2. added theissue type on Sep 7, 2026
  3. SchrodingersGat commented on Sep 7, 2026

    @SchrodingersGat
    Member

    Do you have any custom units defined? If so can you please list them here

  4. removed
    triage:not-checked
    on Sep 7, 2026
  5. added this to the 1.5.3 milestone on Sep 7, 2026
  6. CraigBurden commented on Sep 7, 2026

    @CraigBurden
    Author

    Do you have any custom units defined? If so can you please list them here

    I do:

    Image

    This was a relic from before you released the fix to #12063, I have just removed this unit and now it works!

    This is undesirable behavior

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

    bugquestion

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions