In cases where the optimization fails to find an optimal solution (e.g., due to contradictory or impossible constraints, or if the initial values are poor), the function must return a structured failure object or a clear error message, rather than cryptic NLP output. The code needs robust error handling for optim() convergence failures.