Title: Mixed Frontend and Backend Tool Execution Fails with OpenAI BadRequestError · Issue #3 · CopilotKit/with-langgraph-python · GitHub
Open Graph Title: Mixed Frontend and Backend Tool Execution Fails with OpenAI BadRequestError · Issue #3 · CopilotKit/with-langgraph-python
X Title: Mixed Frontend and Backend Tool Execution Fails with OpenAI BadRequestError · Issue #3 · CopilotKit/with-langgraph-python
Description: Description When executing both frontend and backend tools in a single user request, CopilotKit throws an OpenAI API error related to tool call ID validation. This issue affects both the deprecated coagents-starter example and the newer ...
Open Graph Description: Description When executing both frontend and backend tools in a single user request, CopilotKit throws an OpenAI API error related to tool call ID validation. This issue affects both the deprecated...
X Description: Description When executing both frontend and backend tools in a single user request, CopilotKit throws an OpenAI API error related to tool call ID validation. This issue affects both the deprecated...
Opengraph URL: https://github.com/CopilotKit/with-langgraph-python/issues/3
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mixed Frontend and Backend Tool Execution Fails with OpenAI BadRequestError","articleBody":"### Description\n\nWhen executing both frontend and backend tools in a single user request, CopilotKit throws an OpenAI API error related to tool call ID validation. This issue affects both the deprecated `coagents-starter` example and the newer `with-langgraph-python` example.\n\nThe error occurs when a user requests actions that require both server-side execution (e.g., `get_weather`) and frontend UI updates (e.g., `change_color`) in the same prompt.\n\n### Examples Affected\n\n- `coagents-starter` ([original](https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter) example)\n- `with-langgraph-python` (modernized example)\n\n### Steps to Reproduce\n\n1. Run this example\n2. In the chat interface, enter a prompt that triggers both frontend and backend tools:\n ```\n Get the weather in SF, and change the color to brown\n ```\n\n### Expected Behavior\n\nBoth tools should execute successfully:\n1. The backend `get_weather` tool should fetch weather data for San Francisco\n2. The frontend `change_color` tool should update the UI color to brown\n3. The assistant should provide a response summarizing both actions\n\n### Actual Behavior\n\nThe request fails with an OpenAI API error:\n\n```\nopenai.BadRequestError: Error code: 400 - {\n 'error': {\n 'message': \"Invalid parameter: 'tool_call_id' of 'call_qhvIZb4R9Jzv59TZPYBPnDih' not found in 'tool_calls' of previous message.\", \n 'type': 'invalid_request_error', \n 'param': 'messages.[26].tool_call_id', \n 'code': None\n }\n}\n```\n\n\n----\n\nIt seems that some message sequencing / ordering issue is happening when generating the requests to the LLM is triggering the issue.\n\nMay be related to https://github.com/CopilotKit/CopilotKit/issues/561\n\nThis looks to be not a problem with the example per se, but with how its using copilotkit sdk or a copilotkit issue.\n\nThanks! \n","author":{"url":"https://github.com/kittenkill","@type":"Person","name":"kittenkill"},"datePublished":"2025-07-24T18:34:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/3/with-langgraph-python/issues/3"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b3be5f82-c375-37cf-fc46-09cbcee051ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF0C:126824:8851D6:B22845:698D62F4 |
| html-safe-nonce | 70003826c6d85316adb075910f58a4415387161424a463361bc9361bd0afca59 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjBDOjEyNjgyNDo4ODUxRDY6QjIyODQ1OjY5OEQ2MkY0IiwidmlzaXRvcl9pZCI6IjIyODYzODU2MTM4OTA3NzIzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9206ed48bd9cc74b4a1f9f53482112e125c5357b930e2706764b419649ac09ec |
| hovercard-subject-tag | issue:3260840190 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/CopilotKit/with-langgraph-python/3/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9ad7d9a5dd647bb8d6021eb5b4b1ece6199f4b4a3dd357196bbc876fdde51bb/CopilotKit/with-langgraph-python/issues/3 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9ad7d9a5dd647bb8d6021eb5b4b1ece6199f4b4a3dd357196bbc876fdde51bb/CopilotKit/with-langgraph-python/issues/3 |
| og:image:alt | Description When executing both frontend and backend tools in a single user request, CopilotKit throws an OpenAI API error related to tool call ID validation. This issue affects both the deprecated... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kittenkill |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a |
| turbo-cache-control | no-preview |
| go-import | github.com/CopilotKit/with-langgraph-python git https://github.com/CopilotKit/with-langgraph-python.git |
| octolytics-dimension-user_id | 131273140 |
| octolytics-dimension-user_login | CopilotKit |
| octolytics-dimension-repository_id | 1006752695 |
| octolytics-dimension-repository_nwo | CopilotKit/with-langgraph-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1006752695 |
| octolytics-dimension-repository_network_root_nwo | CopilotKit/with-langgraph-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 715890fa442134f528fb422ab338c0ad55c7a025 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width