Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
Summary
When using Kimi with model k2p5 via the Anthropic Messages–compatible streaming path (anthropic-messages), OpenClaw fails on assistant runs with:
Unexpected event order, got message_start before receiving "message_stop"
This comes from the @anthropic-ai/sdk stream parser when the upstream SSE sequence is invalid (e.g. a new message_start arrives before the previous assistant message received message_stop). The Control UI shows the equivalent event order / stream sequence error. Restarting the gateway, refreshing the page, or opening a new session does not reliably fix it once the failure pattern appears.
The issue persisted across OpenClaw upgrades (currently on 2026.3.28). The same setup had worked normally for roughly one month before the failures began.
Environment
- OpenClaw:
2026.3.28(f9b1079) —openclaw --version - Node.js:
v22.22.0 - Host: Windows with WSL2 (userland paths under
/home/...) - Model / provider (effective):
k2p5, providerkimi(Kimi Coding / Anthropic-compatible endpoint as configured by OpenClaw) - Install:
npm install -g openclaw@latest
Steps to reproduce
- Configure Kimi Coding API credentials in OpenClaw (Kimi Code / Kimi for Coding product).
- Select
k2p5(UI may showkimi/k2p5or equivalent). - Open Control UI web chat and send a normal user message.
- Observe the failure in the UI banner and in gateway logs (
embedded_run_agent_endwithassistant_error).
Actual behavior
- Assistant run ends with
isError: trueand the error text above. - Chat cannot complete a turn; error repeats on subsequent attempts.
Expected behavior
- Streaming completes with a well-formed
message_stopsequence, or the client falls back safely. - A single bad stream should not leave the session permanently broken; session transcript repair should drop incomplete tool-call blocks (e.g. streaming-only
partialJson) so the next request does not cascade into repeated stream errors.
Gateway log excerpt (redacted)
Log file: /tmp/openclaw/openclaw-2026-03-30.log (JSON lines).
Representative embedded_run_agent_end event :
{
"subsystem": "agent/embedded",
"event": "embedded_run_agent_end",
"tags": ["error_handling", "lifecycle", "agent_end", "assistant_error"],
"runId": "<run-id>",
"isError": true,
"error": "Unexpected event order, got message_start before receiving \"message_stop\"",
"failoverReason": null,
"model": "k2p5",
"provider": "kimi",
"rawErrorPreview": "Unexpected event order, got message_start before receiving \"message_stop\"",
"rawErrorHash": "sha256:e52189f5ca9c"
}
### Steps to reproduce
1. Start OpenClaw 2026.2.17 using the configuration attached to this issue.
2. In the affected chat, send a Telegram thread reply (reply in the same conversation flow you normally use).
3. Check whether a reply is posted, and in the attached gateway logs confirm the line indicating “target for reply not found” (or the equivalent English message in your log).
### Expected behavior
On 2026-02-10, the same agent successfully posted replies in the same Telegram topic using the same workflow. The expected behavior is that replies continue to be delivered in that topic under the same configuration.
### Actual behavior
No reply was posted to that topic. The attached gateway logs show a “target for reply not found” error at 14:23:08 UTC.
### OpenClaw version
2026.3.13、2026.3.28
### Operating system
Windows 11 + WSL2
### Install method
npm install -g openclaw
### Model
kimi-coding/k2p5
### Provider / routing chain
openclaw -> https://api.kimi.com/coding/(Anthropic-compatible)
### Additional provider/model setup details
_No response_
### Logs, screenshots, and evidence
```shell
Impact and severity
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
charles0-0 commentedon Mar 30, 2026
same question
ingozy commentedon Mar 30, 2026
I'm experiencing the same issue. My OpenClaw version is 3.13, and I'm using the kimi-coding/k2p5 model. This suddenly started happening after 11:50 today (March 30th) — everything was working fine before that.
My colleague is using the same API key with OpenClaw version 3.2, and it's working normally for them.
XHJ-Studio commentedon Mar 30, 2026
I'm experiencing the exact same error!
My setup:
OpenClaw version: 2026.3.13 (different from the reporter - I haven't upgraded to 2026.3.28 yet)
Model: kimi-coding/k2p5
Issue started: First appeared today (2026-03-30)
Key difference:
My configuration was working perfectly for a long time before this. The error started appearing suddenly today with no updates or configuration changes on my end.
Error message matches exactly:
This looks more like a temporary issue on Kimi API's side rather than an OpenClaw version-specific problem, because:
Different versions (2026.3.13 and 2026.3.28) are both affected
Both started experiencing the issue today (2026-03-30)
Both were working normally for an extended period before
Hope the team can investigate the Kimi API compatibility issue soon!
jiahello commentedon Mar 30, 2026
use model "kimi code" got the same error "Unexpected event order, got message_start before receiving "message_stop"
v2026.3.28
VipMason commentedon Mar 30, 2026
same question
easy8in commentedon Mar 30, 2026
same question
lsh1994 commentedon Mar 30, 2026
同样的问题
aprilandjan commentedon Mar 30, 2026
It worked sereral hours ago, and failed right now, without any changes in openclaw nor its configuration. might be kimi api backend issues 🤔
Little-Initiate commentedon Mar 30, 2026
Same. This suddenly started happening around 11:50 today (March 30th) — everything was working fine before that. And I had tried v3.28 and v3.24, neither of them worked properly.
BTW, I had also send this issue to Kimi Code's officials.
cyijun commentedon Mar 30, 2026
3.13 met this too. Only kimi claw is fine
easy8in commentedon Mar 30, 2026
That's right, it was 11:50 this morning. (Only WSL's OpenClaw, MacBook's OpenClaw were successful, and Ubuntu 24's OpenClaw was successful.)
Little-Initiate commentedon Mar 30, 2026
Seems like v2.26 dont have this problem. I can chat with Kimi k2p5(Kimi coding) on openclaw tui.
fishel-feng commentedon Mar 30, 2026
Same issue, and I didn’t make any changes.
28 remaining items
ironbox360 commentedon Mar 30, 2026
My Temporary Workaround for Kimi-Code Connection Issues
Run the command:
openclaw onboardSelect
Custom Providerand use the following parameters:Base URL:
https://api.kimi.com/coding/Compatibility:
Anthropic-compatibleModel ID:
kimi-coding(doesn't matter)Caution: "This workaround will store the
apiKeyin plain text within the openclaw.json file."Then modify
"reasoning" to true,,"contextWindow"to262144, and"maxTokens"to32768,And the result is as the following.
lolydleo commentedon Mar 30, 2026
Perhaps it's a problem with the Kimi K2.5 model; I encountered the same issue using Kimi Code K2.5. However, the problem disappeared after switching to DeepSeek.
yadnuses commentedon Mar 30, 2026
yes,i try switching to deepseek, the problem are disappear
mazaruz commentedon Mar 30, 2026
This one works for me.
Qrym commentedon Mar 30, 2026
I was hitting the "Unexpected event order" error with Kimi k2p5 on v2026.3.13. I suspect it might be related to me dumping a huge chunk of text into it earlier, probably made the request body balloon and messed up the SSE stream parsing.
Tried rolling back to v2026.3.2 and so far it's looking good, no more errors and responses are coming through fine.
heyAyushh commentedon Mar 30, 2026
There are two kimi issues that are messing as of today.
pepsykolya commentedon Mar 30, 2026
I love u!!!
easy8in commentedon Mar 30, 2026
easy8in commentedon Mar 31, 2026
my config:
fishel-feng commentedon Mar 31, 2026
It seems to be resolved already. I didn’t change any configuration. I received a push from Corn this morning, and now I can talk to it normally.
kanmanhu-less commentedon Mar 31, 2026
同样的问题我都遇到了,第一个我通过回滚版本到3.13解决了,应该是3.28增加了参数但是kimi没有适配,第二个问题昨天晚上kimi应该也已经修复了,我昨晚22:00左右使用已经恢复了
steipete commentedon Apr 25, 2026
Closing this as not reproducible on current
mainafter Codex review.Issue appears to have been a transient Kimi Coding upstream streaming outage on March 30, 2026, not a persistent OpenClaw mainline regression. Current main also contains guardrails that turn this parser failure into a retryable user-facing error and avoid cascading transcript repair damage from aborted/errored tool-call turns.
What I checked:
formatAssistantErrorTextnow catches invalid Anthropic stream ordering errors and returns a safe user-facing retry message instead of surfacing the rawmessage_start/message_stopparser text. (src/agents/pi-embedded-helpers/errors.ts:1072, c65aa1d2a6e5)sanitizeUserFacingTextalso recognizes the same invalid event-order error and rewrites it to the same retry copy, so the raw parser message no longer leaks through chat/UI surfaces on current main. (src/agents/pi-embedded-helpers/sanitize-user-facing-text.ts:409, c65aa1d2a6e5)repairToolUseResultPairingexplicitly skips synthesizing missing tool results when an assistant turn ended withstopReason === "error"or"aborted", which reduces the follow-on transcript corruption the report called out. (src/agents/session-transcript-repair.ts:536, c65aa1d2a6e5)repairToolCallInputsdrops raw tool-call blocks that are missing input, id, or allowed tool names before replay, covering another class of broken partial stream artifacts. (src/agents/session-transcript-repair.ts:319, c65aa1d2a6e5)message_start/message_stopinvalid stream-order provider errors with a safe retry message. (CHANGELOG.md:2253, c65aa1d2a6e5)Review notes: reviewed against c65aa1d2a6e5.