Bug description
When searching certain terms using the /v2/search endpoint, the server throws a 500 (Internal Service Error). On the front-end, this cause the website to crash.
Investigating the staging branch on local, I caught the following information from the stack trace in the terminal when attempting to search the query "dragon":
File "/xyz/Documents/code/open5e-api/search/serializers.py", line 67, in get_object
return result_detail.search_result_extra_fields()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/xyz/Documents/code/open5e-api/api_v2/models/document.py", line 149, in search_result_extra_fields
"school":self.school.key,
^^^^^^^^^^^
AttributeError: 'Item' object has no attribute 'school'
[15/May/2026 21:34:02] "GET /v2/search/?limit=5000&document__key__in=no-sources&schema=v2&query=dragon HTTP/1.1" 500 22877
It looks like the search serializers are attempting to the index into the 'school' field of the Item serializer, which doesn't have that field (it is a Spell field).
Steps to Reproduce
Visit the Open5e website and use the search bar to search for any of the following terms:
- Dragon
- Sword
- Shield
- Ring
- Strength
And you will hit the error page (500: Internal Service Error)
However, the bug does not occur when the following terms are searched for:
- Goblin
- Fireball
- Devil
- Acolyte
- Fighter
Bug description
When searching certain terms using the
/v2/searchendpoint, the server throws a 500 (Internal Service Error). On the front-end, this cause the website to crash.Investigating the
stagingbranch on local, I caught the following information from the stack trace in the terminal when attempting to search the query "dragon":It looks like the search serializers are attempting to the index into the
'school'field of theItemserializer, which doesn't have that field (it is aSpellfield).Steps to Reproduce
Visit the Open5e website and use the search bar to search for any of the following terms:
And you will hit the error page (500: Internal Service Error)
However, the bug does not occur when the following terms are searched for: