GPT-5.2 occasionally fails to produce valid tool call

Hey,
We’ve observed that occasionally gpt-5.2 fails to produce valid tool call. Instead of tool call object being returned by the API, it returns json representing arguments of tool call as part of intermediate message.

Here are some examples:

<preamble>I’m going to look up your current reporting line and any direct reports in our internal directory so I can summarise your org structure accurately...</preamble>
```json
{"recipient":"company_knowledge_agent","content":"Objective: Provide org structure for Michal Marciniak (Michal.Marciniak@pib-insurance.com). Expected Output: Manager, manager chain (if available), direct reports (if any), department/team."}```

Another example:

<preamble>I’m going to translate the two uploaded PDF policy documents into Polish while keeping the original structure and headings consistent...</preamble>
```json
{"recipient":"translation_agent","content":"Objective: Translate the two PDFs to Polish. Inputs: <file>PIPolicyWording-QBEUK.pdf</file> <file>allianz-policy.pdf</file> Expected Output: Polish translations of both documents (as files)."}```

It looks like it generates json representing only arguments for the tool call instead of full json representing tool call. It probably makes the intermediate layer in the OpenAI API fail to process it as tool call and it is being returned as part of normal text message.

Did you also observed such behaviour? We tried the same setup on gpt-5, gpt-5-mini, gpt-5.1 and gpt-5.2, and it happens only for gpt-5.2

Additional context: We instruct the model to wrap intermediate messages in tags for our internal postprocessing before sending to user, and we instruct him to wrap final message in <final_message></final_message> tags. It works fine for all gpt-5x models except for gpt-5.2 where it occasionally fails to create tool call and adds parts of it to the intermediate message as stated above.

1 Like

Running into the similar issue. We are observing 6% fail rate in all of our messages due to this.

Sometimes it hallucinates json structure:

```json


{
    "calls": [
        {
            "tool": "…”,
            "args": “…”
        }
    ]
}

```

Sometimes commentary xml structure, like:


<commentary to=functions.parallelGet _一本道json

{
    "calls": [...]
}

We had other XML like hallucinations, that we were able to reduce by limiting our own XML in the history we send to the model. Seems like anything XML present in history confuses it further.