straight-napkin-27920
04/16/2026, 7:36 PM"Unexpected role 'user' after role 'tool'","type":"invalid_request_error"
I feel like I might have missed a configuration somewhere. This happens intermittently, but I would say over 50% of the time.modern-fireman-99755
04/16/2026, 9:32 PMstraight-napkin-27920
04/17/2026, 5:44 AM{
"id": "8fdd339d-9281-4da1-94d3-693e85c6d9ce",
"timestamp": "2026-04-16T15:26:20.421724",
"source": "environment",
"forgotten_event_ids": [
"2f517db2-8b2d-4e2c-893c-2f88f2dde95c",
"fc7db3e7-4a5f-47df-821f-ce5d3bc6e126",
"8b12b13d-d6e5-4f9a-86ea-75601b92b254",
"6329ee79-c7aa-4b59-804b-714a66014a03",
"0b3b9144-155b-43ae-8882-6cec17d124ff",
"ea6ab82e-9100-4d9e-9a3a-cb8cd5f9e76c",
"a73d0575-9169-469a-a7ff-b94980134f3a",
"57901f9a-3887-45ee-934f-ee28c9389d0a",
"b188772a-7169-43e4-bb8b-482e71c10f57",
"fe0742c9-b167-40a2-b506-9b09e2164a77",
"fb375a2f-10fa-441d-b4e9-d70841544166",
"4f50c5ad-1825-4a35-b58b-4a08a227c181",
"ac610102-8629-42c4-842c-6cd88df9c848",
"5976f686-2d0e-4e89-92f3-9f3903a75068",
"f2b2e3ec-3f26-4d02-821e-f7af25689ce8",
"d8876c49-ec0b-4838-83ff-99e36af30eb7",
"d6f45d5d-2897-4dad-8b0c-13468ac07842",
"630b1fd9-6858-44e9-87c1-77f451229802",
"a3962634-6937-4fb2-b78a-c76ade245299",
"065f5260-861d-474c-951e-0cc758cfd895",
"7522cb28-a74d-4e86-97d6-b47543847a03",
"3f766ee6-dbba-470a-b32d-5ae0d87b9028",
"731614b3-5871-45f2-b5c6-c42e15946947",
"e4af7259-ada0-459d-9534-6131a98cf6a4",
"5c1d2f27-1e74-445f-a200-90f808c848fb",
"c6c9c4e1-ebe9-45db-88e5-5b75e807ef10",
"784a8c09-be7f-4a7a-9047-3da39b3f2cca",
"ddcf1ed4-519e-43cb-949a-3008f3f1ee61",
"dc3ee4bb-75ef-4483-beba-c3c37f542382",
"4bd984a9-8313-4f69-9876-3859ad08160d",
"19a574b9-fb30-4910-ad0c-6ce7b8120528",
"72d8f73e-ecb3-4737-a1b4-c553918d3a00",
"143a734a-96f8-4603-8e2a-0f2fe20d77cd",
"34833e30-8414-4c04-af7d-31ec989c27ce",
"ece68066-096d-4604-ba65-618c9c957838",
"51845670-98e6-4ec6-b94f-c9c2a6664bf9",
"cea37701-d800-488b-9af1-60cf1261aad8",
"5493289a-b4a5-458a-8cbd-0a51827c7f24",
"c4a4f795-d01c-44dc-80b4-549a6157637d",
"bd8e987b-702f-4f15-a7cf-47bdf45c40f9",
"39947739-5ce7-4b9e-aa05-363fb3cfe9d3",
"b3219679-2340-4201-bb51-989d02f3dc14",
"5722a22b-6748-4a07-b8ba-b0b3daa39fcc",
"3ae0610d-c43f-4f97-a1e7-3ed2dd77775e"
],
"summary": "Here's the context-aware state summary based on the events:\n\n```\nUSER_CONTEXT: Understanding the difference between Database CRD and Cluster CRD in CNPG, and examining current database configurations in the repository\n\nTASK_TRACKING:\n- TASK-001: Research Database vs Cluster CRD differences (IN_PROGRESS)\n- TASK-002: Examine current database configurations (IN_PROGRESS)\n\nCOMPLETED:\n- Reviewed CNPG documentation for API reference\n- Examined Database CRD structure\n- Examined Cluster CRD structure\n- Found and reviewed existing database configurations in kustomize/overlays/denodo/resources/\n- Found and reviewed base database configurations in denodo/base/postgresql/\n- Found and reviewed cluster configurations (postgres-cluster.yaml and denodo-postgresql-cluster.yaml)\n\nPENDING:\n- Complete analysis of Database vs Cluster CRD differences\n- Understand how databases are currently configured and managed\n- Determine if any changes are needed to the current setup\n\nCURRENT_STATE:\n- Found 3 database YAML files in overlays/denodo/resources/:\n - scheduler-database.yaml\n - solutionmanager-database.yaml\n - datacatalog-database.yaml\n- Found 4 database YAML files in base/postgresql/:\n - denodo-vdp-database.yaml\n - denodo-scheduler-database.yaml\n - denodo-datacatalog-database.yaml\n - denodo-postgresql-cluster.yaml (Cluster CRD)\n- All databases reference Cluster CRDs (postgres-cluster or denodo-postgresql-cluster)\n- Cluster configurations found in:\n - kustomize/overlays/denodo/resources/postgres-cluster.yaml\n - denodo/base/postgresql/denodo-postgresql-cluster.yaml\n\nCODE_STATE:\n- Database CRD files: <http://postgresql.cnpg.io/v1|postgresql.cnpg.io/v1>, kind: Database\n- Cluster CRD files: <http://postgresql.cnpg.io/v1|postgresql.cnpg.io/v1>, kind: Cluster\n- Files examined:\n - /home/sandbox/denodo/kustomize/overlays/denodo/resources/*.yaml\n - /home/sandbox/denodo/denodo/base/postgresql/*.yaml\n\nTESTS:\n- Found test file: /home/sandbox/denodo/tests/acceptance/test_odbc_login.py\n- No specific test failures identified yet\n\nCHANGES:\n- No changes made yet, currently in research phase\n\nDEPS:\n- CNPG API (<http://postgresql.cnpg.io/v1|postgresql.cnpg.io/v1>)\n- Kubernetes resources\n- Kustomize configurations\n\nVERSION_CONTROL_STATUS:\n- No version control operations performed yet\n- Current working directory: /home/sandbox/denodo\n```",
"summary_offset": 4,
"llm_response_id": "chatcmpl-c6fb8f70-0f76-49a2-b3d8-dee0fc41014a",
"kind": "Condensation"
}
{
"id": "e9cf6e39-72c3-40e6-8337-213eeec77041",
"timestamp": "2026-04-16T15:26:20.634794",
"source": "environment",
"code": "LLMBadRequestError",
"detail": "litellm.BadRequestError: OpenAIException - Unexpected role 'user' after role 'tool'",
"kind": "ConversationErrorEvent"
}modern-fireman-99755
04/17/2026, 6:14 AMCondensation event (the context summarization you see in event 82) as a user role message after tool results, Mistral rejects it.
Actually, it is a well-known problem:
• OpenCode: https://github.com/anomalyco/opencode/issues/7488
• Zed Editor: https://github.com/zed-industries/zed/issues/37021, https://github.com/zed-industries/zed/issues/31491
• avante.nvim: https://github.com/yetone/avante.nvim/issues/2562
• OpenHands: https://github.com/All-Hands-AI/OpenHands/issues/8685
However, it seems that this was happening in OpenHands only for versions below 1. Which version are you using? (I assume greater than 1)
The only workaround I have in mind right now is to use another model.
@calm-artist-7206 probably you know a bit more about the problem and/or have better workarounds/solutions
@wide-doctor-37830 tagging you because of the condenserstraight-napkin-27920
04/17/2026, 6:17 AMAGENT_ENABLE_FINISH=false . I have used this and not been able to get passed this error.modern-fireman-99755
04/17/2026, 6:23 AMcalm-artist-7206
04/17/2026, 8:30 AMkeep_first=2 condenser option, though I thought it's defaultcalm-artist-7206
04/17/2026, 8:32 AMtool role... unless there's a bug in the condenser or keep_first attribute is set higher (so it will try to keep some tool calls before summary)straight-napkin-27920
04/17/2026, 8:35 AMmodern-fireman-99755
04/17/2026, 8:57 AMstraight-napkin-27920
04/17/2026, 9:55 AMmodern-fireman-99755
04/17/2026, 10:36 AM