openclaw - 💡(How to fix) Fix Bug: Session reset via Control UI injects blank user message, crashing MiniMax provider [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73848Fetched 2026-04-29 06:14:16
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
closed ×1commented ×1

When a session is reset via sessions.patch from the Control UI, the new session is created with a blank user message (content: [{"type": "text", "text": ""}]). This causes MiniMax to reject the request with error 2013 ("invalid params, messages must not be empty"), triggering an unnecessary model fallback. OpenClaw's self-repair mechanism eventually cleans up the blank message, but only after the first turn has already failed and fallen back to a different model.

Error Message

When a session is reset via sessions.patch from the Control UI, the new session is created with a blank user message (content: [{"type": "text", "text": ""}]). This causes MiniMax to reject the request with error 2013 ("invalid params, messages must not be empty"), triggering an unnecessary model fallback. OpenClaw's self-repair mechanism eventually cleans up the blank message, but only after the first turn has already failed and fallen back to a different model. error=LLM request rejected: invalid params, messages must not be empty (2013) 23:43:47 [agent/embedded] embedded run agent end: isError=true model=MiniMax-M2.7 error=invalid params, messages must not be empty (2013)

Root Cause

  • User-visible: Confusing experience — model fails, fallback kicks in on a different model, then appears to "recover". User sees an unexpected model responding.
  • Self-repair masks the bug: The blank message is cleaned up automatically, so the session eventually works, but the root cause (blank message injection on reset) persists.
  • Provider-specific: MiniMax rejects empty messages; other providers (OpenAI, Anthropic) may silently accept them, hiding the issue.

Fix Action

Fix / Workaround

When a session is reset via sessions.patch from the Control UI, the new session is created with a blank user message (content: [{"type": "text", "text": ""}]). This causes MiniMax to reject the request with error 2013 ("invalid params, messages must not be empty"), triggering an unnecessary model fallback. OpenClaw's self-repair mechanism eventually cleans up the blank message, but only after the first turn has already failed and fallen back to a different model.

  1. Open a per-peer session (e.g. agent:main:direct:bob) in the Control UI
  2. Reset or patch the session (e.g. via model change or session reset in the UI)
  3. The new session file is created with a blank user message before any real user input
  4. If the model is MiniMax, it rejects the empty message array with HTTP 400
23:43:22 [ws] sessions.patch 105ms
23:43:47 [agent/embedded] embedded run agent end: isError=true model=MiniMax-M2.7 error=invalid params, messages must not be empty (2013)
23:43:48 [model-fallback/decision] decision=candidate_failed requested=minimax/MiniMax-M2.7 next=openai/gpt-5.4-mini
23:43:53 [agent/embedded] session file repaired: rewrote 1 assistant message(s), dropped 1 blank user message(s)
23:44:10 [model-fallback/decision] decision=candidate_succeeded candidate=openai/gpt-5.4-mini
23:44:17 [agent/embedded] session file repaired: dropped 1 blank user message(s)

Code Example

{
  "type": "message",
  "id": "2d8f982d",
  "timestamp": "2026-04-28T22:43:46.836Z",
  "message": {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": ""
      }
    ]
  }
}

---

embedded run agent end: isError=true model=MiniMax-M2.7 provider=minimax
error=LLM request rejected: invalid params, messages must not be empty (2013)

---

23:43:22 [ws] sessions.patch 105ms
23:43:47 [agent/embedded] embedded run agent end: isError=true model=MiniMax-M2.7 error=invalid params, messages must not be empty (2013)
23:43:48 [model-fallback/decision] decision=candidate_failed requested=minimax/MiniMax-M2.7 next=openai/gpt-5.4-mini
23:43:53 [agent/embedded] session file repaired: rewrote 1 assistant message(s), dropped 1 blank user message(s)
23:44:10 [model-fallback/decision] decision=candidate_succeeded candidate=openai/gpt-5.4-mini
23:44:17 [agent/embedded] session file repaired: dropped 1 blank user message(s)
RAW_BUFFERClick to expand / collapse

Bug: Session reset via Control UI injects blank user message, crashing MiniMax provider

Summary

When a session is reset via sessions.patch from the Control UI, the new session is created with a blank user message (content: [{"type": "text", "text": ""}]). This causes MiniMax to reject the request with error 2013 ("invalid params, messages must not be empty"), triggering an unnecessary model fallback. OpenClaw's self-repair mechanism eventually cleans up the blank message, but only after the first turn has already failed and fallen back to a different model.

Steps to Reproduce

  1. Open a per-peer session (e.g. agent:main:direct:bob) in the Control UI
  2. Reset or patch the session (e.g. via model change or session reset in the UI)
  3. The new session file is created with a blank user message before any real user input
  4. If the model is MiniMax, it rejects the empty message array with HTTP 400

Expected Behaviour

A freshly reset session should not contain any user messages until the user actually sends one. The session file should start with only the session header, model_change, and thinking_level_change entries.

Actual Behaviour

The session file starts with a blank user message:

{
  "type": "message",
  "id": "2d8f982d",
  "timestamp": "2026-04-28T22:43:46.836Z",
  "message": {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": ""
      }
    ]
  }
}

This is immediately followed by MiniMax rejecting it:

embedded run agent end: isError=true model=MiniMax-M2.7 provider=minimax
error=LLM request rejected: invalid params, messages must not be empty (2013)

OpenClaw then:

  1. Falls back to openai/gpt-5.4-mini (model fallback, reason=format)
  2. Self-repairs the session file ("rewrote 1 assistant message(s), dropped 1 blank user message(s)")
  3. A second repair pass drops another blank user message

Log Evidence

23:43:22 [ws] sessions.patch 105ms
23:43:47 [agent/embedded] embedded run agent end: isError=true model=MiniMax-M2.7 error=invalid params, messages must not be empty (2013)
23:43:48 [model-fallback/decision] decision=candidate_failed requested=minimax/MiniMax-M2.7 next=openai/gpt-5.4-mini
23:43:53 [agent/embedded] session file repaired: rewrote 1 assistant message(s), dropped 1 blank user message(s)
23:44:10 [model-fallback/decision] decision=candidate_succeeded candidate=openai/gpt-5.4-mini
23:44:17 [agent/embedded] session file repaired: dropped 1 blank user message(s)

Impact

  • User-visible: Confusing experience — model fails, fallback kicks in on a different model, then appears to "recover". User sees an unexpected model responding.
  • Self-repair masks the bug: The blank message is cleaned up automatically, so the session eventually works, but the root cause (blank message injection on reset) persists.
  • Provider-specific: MiniMax rejects empty messages; other providers (OpenAI, Anthropic) may silently accept them, hiding the issue.

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • Node: v25.6.1
  • OS: Ubuntu 24.04 (Linux 6.8.0-110-generic, x64)
  • Primary model: minimax/MiniMax-M2.7 (via Ollama cloud proxy)
  • Fallback model: openai/gpt-5.4-mini
  • UI: Control UI (webchat)

Suggested Fix

Prevent sessions.patch (or the session reset codepath) from injecting a user message with empty content. Alternatively, filter out blank user messages before sending to the LLM provider, rather than relying on post-failure self-repair.

extent analysis

TL;DR

Prevent sessions.patch from injecting a blank user message or filter out empty messages before sending to the LLM provider to avoid MiniMax rejection.

Guidance

  • Review the sessions.patch code to identify where the blank user message is being injected and modify it to not include empty messages.
  • Consider adding a filter to remove blank user messages before sending the session data to the LLM provider, such as MiniMax.
  • Verify that the session file is correctly formatted after a reset, ensuring it only contains the session header, model change, and thinking level change entries, without any user messages.
  • Test the fix with different models, including MiniMax, OpenAI, and Anthropic, to ensure the issue is resolved across various providers.

Example

No code snippet is provided as the issue does not include specific code details, but the fix would involve modifying the sessions.patch code or adding a filter to remove blank user messages.

Notes

The suggested fix assumes that the issue is caused by the injection of blank user messages during the session reset process. However, without access to the specific code, it is difficult to provide a more detailed solution.

Recommendation

Apply a workaround to filter out blank user messages before sending to the LLM provider, as this approach does not require modifying the underlying sessions.patch code and can be implemented as a temporary fix until the root cause is addressed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING