From 02552b05af95f6f3d2f87e3504918ad85f0bb32c Mon Sep 17 00:00:00 2001 From: Juxsta Date: Sat, 7 Feb 2026 23:06:13 -0800 Subject: [PATCH] Fix: wrap string system prompts as text block objects The Anthropic API expects system array items to be objects with type and text fields, not raw strings. When receiving a string system prompt, now properly wraps it as {type:"text", text:...} This fixes errors when clients send the system prompt as a plain string rather than an array of content blocks. --- server/ClaudeRequest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ClaudeRequest.js b/server/ClaudeRequest.js index 4a468d8..bccd229 100644 --- a/server/ClaudeRequest.js +++ b/server/ClaudeRequest.js @@ -342,7 +342,7 @@ class ClaudeRequest { if (Array.isArray(body.system)) { body.system.unshift(systemPrompt); } else { - body.system = [systemPrompt, body.system]; + body.system = typeof body.system === 'string' ? [systemPrompt, { type: 'text', text: body.system }] : [systemPrompt, body.system]; } } else { body.system = [systemPrompt];