Skip to content

[Bug]: Anthropic API 400 Error: system message missing type field in large context #91

@yishouGame

Description

@yishouGame

Operating system

Windows 10

Locus version

0.4.1

Model endpoint

DeepSeek V4 pro-Anthropic API

Description

对话上下文较大(请求体约 500KB+,column 507186)时触发。推测是 Locus 在序列化大上下文的多轮对话消息时,某个 system 消息对象遗漏了 Anthropic API 要求的 type 字段,导致反序列化失败。

Steps to reproduce

  1. 在同一个会话中持续工作较长时间,积累大量上下文
  2. 发送新的消息触发 API 调用
  3. 返回 400 Bad Request

Logs or screenshots

emitting Error for session 43b9de93-2aaa-46da-8a76-940dba975a34
run 43b9de93-2aaa-46da-8a76-940dba975a34_1781246957713:
Custom(Anthropic) API error (400 Bad Request):
{"error":{"message":"Failed to deserialize the JSON body into the target type:
system: missing field type at line 1 column 507186",
"type":"invalid_request_error","param":null,"code":"invalid_request_error"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions