Technical explanation for o4-mini web search error

Just to let you know - mandating a function call is not a good idea if you are not in control of the loop and aware of the consequence:

The AI can only continue to call tools. It cannot decide that after an iteration or several tool returns are seen in the input that it is done and only output a response to the user.

The parameter being sent continues to mandate tool outputs, and your code should shut off the parameter after the first or the required number of function calls.

Also, why would you use it in conjunction with web search? You are providing an internal tool - and then an exclusive function of your own to bypass other tool use (or mandating “none”). It seems like the API parameter guardrail is saving you from yourself. Perhaps you can think deeper about what you expect the AI to do as internal iterative action vs your provided named function of priority, and just work up function specification descriptions that make their utility clear.