Please verify that this bug has NOT been raised before.
Describe the bug*
When LDAP authentication is enabled and group permission lookup is active,
an invalid or missing LDAP group search base can cause runtime HTTP 500
errors during normal API requests.
Example configuration:
ldap:
enabled: true
find_group_perms: true
No valid ldap.group_search is configured.
In this situation InvenTree starts normally and user authentication works.
However, later requests trigger LDAP group lookups and fail with:
search_ext() argument 1 must be str, not None
Debug output shows:
Invoking search_s(
'None',
2,
'(&(objectClass=groupOfUniqueNames)(uniqueMember=...))'
)
This eventually produces HTTP 500 responses.
Steps to Reproduce
- Enable LDAP
- Leave ldap.group_search undefined
- Enable group permission lookup
- Log in successfully
- Access API endpoints requiring permission evaluation (just wait some time in the "parts" view)
- Observe UI error and search_s('None', ...) in log files
Expected behaviour
- Fail during startup with a clear configuration error, or
- Disable group lookups automatically when group_search is not configured, or
- Return a meaningful LDAP configuration error instead of HTTP 500.
Deployment Method
Docker
Version Information
InvenTree 1.3.0
django-auth-ldap 5.3.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
Invoking search_s('None', 2, '(&(objectClass=groupOfUniqueNames)(uniqueMember=cn=<cn of user>))')
2026-06-22 21:15:18,421 DEBUG Invoking search_s('None', 2, '(&(objectClass=groupOfUniqueNames)(uniqueMember=<cn of user>))')
2026-06-22T21:15:18.429288Z [error ] search_ext() argument 1 must be str, not None [inventree] ip=95.90.8.162 request_id=15cd907d-97e6-45d1-81ec-9a7cec891f2c user_id=6
2026-06-22 21:15:18,429 ERROR {'event': TypeError('search_ext() argument 1 must be str, not None'), 'ip': 'IP', 'request_id': '15cd907d-97e6-45d1-81ec-9a7cec891f2c', 'user_id': 6, 'timestamp': '2026-06-22T21:15:18.429288Z', 'logger': 'inventree', 'level': 'error'}
2026-06-22T21:15:18.485530Z [error ] request_finished [django_structlog.middlewares.request] code=500 ip=95.90.8.162 request='OPTIONS /api/part/category/?top_level=true' request_id=15cd907d-97e6-45d1-81ec-9a7cec891f2c user_id=6
2026-06-22 21:15:18,485 ERROR {'code': 500, 'request': 'OPTIONS /api/part/category/?top_level=true', 'event': 'request_finished', 'ip': '<IP>', 'request_id': '15cd907d-97e6-45d1-81ec-9a7cec891f2c', 'user_id': 6, 'timestamp': '2026-06-22T21:15:18.485530Z', 'logger': 'django_structlog.middlewares.request', 'level': 'error'}
2026-06-22 21:15:18,486 ERROR Internal Server Error: /api/part/category/
Please verify that this bug has NOT been raised before.
Describe the bug*
When LDAP authentication is enabled and group permission lookup is active,
an invalid or missing LDAP group search base can cause runtime HTTP 500
errors during normal API requests.
Example configuration:
No valid ldap.group_search is configured.
In this situation InvenTree starts normally and user authentication works.
However, later requests trigger LDAP group lookups and fail with:
search_ext() argument 1 must be str, not NoneDebug output shows:
This eventually produces HTTP 500 responses.
Steps to Reproduce
Expected behaviour
Deployment Method
Docker
Version Information
InvenTree 1.3.0
django-auth-ldap 5.3.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