From e5b39b319ea324ae3fe9e8bf9f7d65787f9050be Mon Sep 17 00:00:00 2001 From: Adam Weidman Date: Tue, 12 May 2026 15:03:17 -0400 Subject: [PATCH] fix(core): restore fallback serialization in content-utils to avoid throwing --- packages/core/src/agent/content-utils.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/core/src/agent/content-utils.ts b/packages/core/src/agent/content-utils.ts index 50d054ff0e..42b0b7fec7 100644 --- a/packages/core/src/agent/content-utils.ts +++ b/packages/core/src/agent/content-utils.ts @@ -93,12 +93,13 @@ export function contentPartsToGeminiParts(content: ContentPart[]): Part[] { // References are converted to text for the model result.push({ text: part.text }); break; - default: { - ((x: never) => { - throw new Error(`Unhandled ContentPart type: ${JSON.stringify(x)}`); - })(part); + default: + debugLogger.warn( + `Unhandled ContentPart type: ${JSON.stringify(part)} fallback to serialization`, + ); + // Serialize unknown ContentPart variants instead of dropping them + result.push({ text: JSON.stringify(part) }); break; - } } } return result;