Problem
PluckIt.Infrastructure/StylistService.cs:68 directly accesses result.Content[0].Text without checking if Content is non-empty. If OpenAI returns an empty content array (on refusal or model error) this throws an unhandled IndexOutOfRangeException.
var content = result.Content[0].Text; // throws if Content is empty
Impact
Any stylist recommendation request that receives a non-standard OpenAI response crashes with a 500 and gives the user no actionable message.
Proposed Fix
if (result.Content is not { Count: > 0 })
throw new InvalidOperationException("OpenAI returned empty content.");
var content = result.Content[0].Text;
Functionality Impact
Converts silent crash to explicit structured error response.
Problem
PluckIt.Infrastructure/StylistService.cs:68directly accessesresult.Content[0].Textwithout checking ifContentis non-empty. If OpenAI returns an empty content array (on refusal or model error) this throws an unhandledIndexOutOfRangeException.Impact
Any stylist recommendation request that receives a non-standard OpenAI response crashes with a 500 and gives the user no actionable message.
Proposed Fix
Functionality Impact
Converts silent crash to explicit structured error response.