ollama - 💡(How to fix) Fix Ollama Cloud kimi-k2.5 cannot process SystemMessage perfectly. [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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
ollama/ollama#15056Fetched 2026-04-08 01:31:35
View on GitHub
Comments
3
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×3labeled ×2

Code Example

curl -s localhost:11434/v1/chat/completions -d '{
"model":"kimi-k2.5:cloud",
"messages":[
{"role":"user","content":"Tell me current time without calling any tools."},
{"role":"system","content":"Current time is '"$(date)"'"}
],"stream":false}' | jq -r '.choices[0].message.content'

# If I change the order the answer is right. 

curl -s localhost:11434/v1/chat/completions -d '{
"model":"kimi-k2.5:cloud",
"messages":[
{"role":"system","content":"Current time is '"$(date)"'"},
{"role":"user","content":"Tell me current time without calling any tools."}
],"stream":false}' | jq -r '.choices[0].message.content'
RAW_BUFFERClick to expand / collapse

What is the issue?

I am using the langchain framework. And I found the root reason. It's still a problem. The input may have multi messages. The system message must be put in the first . It will ignore other system message after the user message.

Relevant log output


curl -s localhost:11434/v1/chat/completions -d '{
"model":"kimi-k2.5:cloud",
"messages":[
{"role":"user","content":"Tell me current time without calling any tools."},
{"role":"system","content":"Current time is '"$(date)"'"}
],"stream":false}' | jq -r '.choices[0].message.content'

# If I change the order the answer is right. 

curl -s localhost:11434/v1/chat/completions -d '{
"model":"kimi-k2.5:cloud",
"messages":[
{"role":"system","content":"Current time is '"$(date)"'"},
{"role":"user","content":"Tell me current time without calling any tools."}
],"stream":false}' | jq -r '.choices[0].message.content'

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

extent analysis

Fix Plan

To fix the issue, we need to ensure that the system message is always placed before the user message in the input.

  • Check the input data structure and modify it to prioritize system messages.
  • Use a simple sorting function to reorder the messages based on their roles.

Example code in Python:

def reorder_messages(messages):
    """Reorder messages to prioritize system messages"""
    system_messages = [msg for msg in messages if msg["role"] == "system"]
    user_messages = [msg for msg in messages if msg["role"] == "user"]
    return system_messages + user_messages

# Example usage:
messages = [
    {"role": "user", "content": "Tell me current time without calling any tools."},
    {"role": "system", "content": "Current time is '" + "$(date)" + "'"}
]
reordered_messages = reorder_messages(messages)
print(reordered_messages)

Verification

To verify that the fix worked, test the API with the reordered messages and check the response. The system message should now be correctly placed before the user message.

Extra Tips

  • Always validate and sanitize input data to prevent unexpected behavior.
  • Consider adding error handling to handle cases where the input data is malformed or missing required fields.

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