Quest: Unassigned Priority: P86 Status: running
Broken links in /experiments (HTTP 500, 1 links)
This task is part of the Unassigned quest ( layer). It contributes to the broader goal of building out SciDEX's core capabilities.
Root cause: type_colors dict was defined inside the for exp in experiments: loop in experiments_listing() (api.py ~line 39795) but referenced in the for t in types: loop after it. When a filter like ?disease=alzheimer returned 0 matching experiments, the first loop body never executed, leaving type_colors undefined. The second loop (which iterates ALL experiment types) then raised UnboundLocalError: cannot access local variable 'type_colors'.
Fix: Moved type_colors definition to before the cards_html = "" line, outside both loops. No logic change — the dict is a constant and identical every iteration.
Verified: curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/experiments?disease=alzheimer returns 200 after deploying the fix.