Broken links in /experiments (HTTP 500, 1 links)

← All Specs

Broken links in /experiments (HTTP 500, 1 links)

Quest: Unassigned Priority: P86 Status: running

Goal

Broken links in /experiments (HTTP 500, 1 links)

Context

This task is part of the Unassigned quest ( layer). It contributes to the broader goal of building out SciDEX's core capabilities.

Acceptance Criteria

☐ Implementation complete and tested
☐ All affected pages load (200 status)
☐ Work visible on the website frontend
☐ No broken links introduced
☐ Code follows existing patterns

Approach

  • Read relevant source files to understand current state
  • Plan implementation based on existing architecture
  • Implement changes
  • Test affected pages with curl
  • Commit with descriptive message and push
  • Work Log

    2026-04-25 — Fix UnboundLocalError in experiments_listing

    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.

    Tasks using this spec (1)
    Broken links in /experiments (HTTP 500, 1 links)
    done P86
    File: f418a358-1f2_broken_links_in_experiments_http_500_1_l_spec.md
    Modified: 2026-04-25 23:40
    Size: 1.9 KB