Fixed: ToolApprovalRequestContent found with FunctionCall.CallId(s) that have no matching ToolApprovalResponseContent
I approved a password reset that a Microsoft Agent Framework agent was waiting for, and the run failed with An error occurred while streaming the agent response. The API's console had the real error: InvalidOperationException: ToolApprovalRequestContent found with FunctionCall.CallId(s) '…' that have no matching ToolApprovalResponseContent. I had restarted the API while the approval waited, and its in-memory session store had forgotten the conversation. Asking again started a new approval, and that one worked.
What I Was Doing
In Part 14 of the Microsoft Agent Framework series, an ASP.NET Core API hosts the agent over AG-UI, and a Next.js chat shows the agent's approval requests as cards. The agent's reset_my_password tool is wrapped in ApprovalRequiredAIFunction, so a run that calls it stops and waits for the employee's answer. The API runs in Development, where it keeps conversations with WithInMemorySessionStore().
I asked Please reset my password., and the card appeared. Then, before answering, I restarted the API, as you do many times a day during development: stopped it, and started it again. When it was up, I selected Approve.
What I Expected
The reset, as every approval before had done: A one-time password reset link was sent…
What I Got
The card turned into Approved: Reset my password, and under it came an error:

The chat had passed on the API's own event:
{"type":"RUN_ERROR","message":"An error occurred while streaming the agent response.","code":"StreamingError"}
The API's console had the reason. The API wraps its agent in Agent Framework's logging agent, which logs a failed run with its exception:
fail: LoggingAgent[1784604714]
RunStreamingAsync failed.
System.InvalidOperationException: ToolApprovalRequestContent found with FunctionCall.CallId(s) 'call_VKu2LyzCFOeF2nQhjZa6Xsg5' that have no matching ToolApprovalResponseContent.
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message)
at Microsoft.Extensions.AI.FunctionInvokingChatClient.ExtractAndRemoveApprovalRequestsAndResponses(List`1 messages)
at Microsoft.Extensions.AI.FunctionInvokingChatClient.ProcessFunctionApprovalResponses(List`1 originalMessages, Boolean hasConversationId, String toolMessageId, String functionCallContentFallbackMessageId)
at Microsoft.Extensions.AI.FunctionInvokingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()
…
at Microsoft.Agents.AI.ApprovalResponseBindingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()
…
at Microsoft.Agents.AI.ChatClientAgent.RunCoreStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+MoveNext()
call_VKu2LyzCFOeF2nQhjZa6Xsg5 was the call the card was about.
What I Checked
The answer itself. The chat sends every approval the same way: a new AG-UI run in the same conversation, with a resume entry that carries approved and the tool call. The same code had approved resets all day, so the answer's shape wasn't the problem.
What the restart changed. In Development the API keeps its conversations with WithInMemorySessionStore(), in memory. The waiting call lives in the conversation's session, and stopping the API empties the store. The answer arrived for a conversation the new process had never seen.
What Agent Framework's documentation says about answers. The page Using function tools with human in the loop approvals sends the answer in a new User ChatMessage, along with the same session object. The same page says that Approval-response binding is enabled by default, with a separate opt-out, DisableApprovalResponseBinding.
The call stack. It names that guard: ApprovalResponseBindingChatClient ran before FunctionInvokingChatClient, the part of Microsoft.Extensions.AI that runs tools and handles approvals, threw. In Part 13 I had sent an approval for an invented call to a new conversation, and got the same exception from the same place.
Why It Happens
An approval only counts for a call that is waiting in the same session. After the restart, the session was new and empty: nothing was waiting in it. The binding didn't accept the answer, so FunctionInvokingChatClient was left with an approval request that had no response, and it threw. Agent Framework's AG-UI host turned the exception into the generic RUN_ERROR the chat showed.
The same exception appears whenever an answer doesn't match a waiting call in its conversation: a different threadId, IDs from another run, or a call that never existed.
The Fix
Ask again, and answer the new request. In the chat, I wrote Please reset my password. a second time. The chat's AG-UI client still held the old request, so it sent the new message with a cancelled answer for it, as AG-UI requires. The new API process had nothing to cancel, answered the message normally, and the agent called the tool again:

The old card's line changed to Not answered, which is what really happened to it. The new card belongs to a call that is waiting in the new process's session.
From a .http file, the fix is the same: send the question again, and answer with the id and toolCallId of the new interrupt.
The waiting call can only outlive a restart if the session does. The in-memory store is for development; a store that keeps sessions outside the process is what lets an approval wait across restarts.
After the Fix
I selected Approve on the new card, and the reset ran:

The API's console logged no error this time.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Restarting the API while an approval waits | The waiting call is forgotten, and the answer fails | Answer first, or ask again after the restart |
| Answering with the IDs of another run | No call with those IDs waits in the conversation | Use the id and toolCallId of the interrupt you're answering |
| Turning off approval-response binding to make the error go away | You remove the check that an answer matches a waiting call | Keep it on; ask again instead |
| Sending the answer to another conversation | The answer reaches a session that never asked | Use the same threadId |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
RUN_ERROR An error occurred while streaming the agent response. after an approval | The API failed the run; the reason is in its console | Read the API's log |
InvalidOperationException: ToolApprovalRequestContent found with FunctionCall.CallId(s) '…' that have no matching ToolApprovalResponseContent. | No call with that ID waits in the conversation | Ask again, and answer the new request |
| The error appears right after a restart | The in-memory session store forgot the conversation | Ask again; keep sessions outside the process where they must survive |
| The error appears with no restart | The answer has the wrong IDs or threadId | Answer with the values of the interrupt you're answering |
FAQ
Why doesn't the API say "this approval has expired"?
Because, after the restart, it has no record that the approval ever existed. All it sees is an answer for a call that isn't waiting, which looks exactly like an answer for a call that never was.
Is the error a security feature?
The guard behind it is. Approval-response binding is what stops an answer from approving a call the agent isn't waiting for. When I approved a waiting call with an answer that named a different tool, the API ran the call that was waiting, not the one the answer named.
Conclusion
ToolApprovalRequestContent found with FunctionCall.CallId(s) that have no matching ToolApprovalResponseContent means an approval arrived for a call that isn't waiting in that conversation. After an API restart with the in-memory session store, the conversation and its waiting call are gone. Ask again: the chat closes the lost request as not answered, the agent asks for a new approval, and that one works.
Additional Resources
- Using function tools with human in the loop approvals — answering approvals in the same session, and the defaults that protect them.
- Human-in-the-Loop with AG-UI — approvals over AG-UI.
