Skip to content

The open source coding agent.

TypeScript

fix: Text content blocks must contain non-whitespace text (#3194)

Aiden Clineb2ff4be4c699
diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts
index 8dc059ca187..81b4158dbb8 100644
--- a/packages/opencode/src/session/message-v2.ts
+++ b/packages/opencode/src/session/message-v2.ts
@@ -513,6 +513,8 @@ export namespace MessageV2 {
}
if (msg.info.role === "assistant") {
+ const hasEmptyTextPart = msg.parts.some((part) => part.type === "text" && part.text.trim() === "")
+ if (hasEmptyTextPart) continue
result.push({
id: msg.info.id,
role: "assistant",