Context
Discovered during review of epic #271 (graphify parity closeout).
Description
In semantic_extract.py:193 and vision_extract.py:141, response.content[0].text will raise IndexError if the Claude API returns an empty content list (e.g. content-filter refusal, rate-limit with empty body). The surrounding except Exception catches it, but the traceback is misleading — it looks like a bug rather than an expected API edge case.
Suggested approach
Guard with if not response.content: before indexing, and log a specific warning like "empty API response for {rel}". Return SemanticResult() in that case.
Context
Discovered during review of epic #271 (graphify parity closeout).
Description
In
semantic_extract.py:193andvision_extract.py:141,response.content[0].textwill raiseIndexErrorif the Claude API returns an emptycontentlist (e.g. content-filter refusal, rate-limit with empty body). The surroundingexcept Exceptioncatches it, but the traceback is misleading — it looks like a bug rather than an expected API edge case.Suggested approach
Guard with
if not response.content:before indexing, and log a specific warning like "empty API response for {rel}". ReturnSemanticResult()in that case.