fix(Structured Output Parser Node): Handle passed objects that do not match schema (#17774)

This commit is contained in:
jeanpaul
2025-07-29 13:20:12 +02:00
committed by GitHub
parent 04c1121075
commit 1fb78cb0ea
2 changed files with 28 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ export class N8nStructuredOutputParser extends StructuredOutputParser<
if (e instanceof SyntaxError) {
nodeError.context.outputParserFailReason = 'Invalid JSON in model output';
} else if (
text.trim() === '{}' ||
(typeof text === 'string' && text.trim() === '{}') ||
(e instanceof z.ZodError &&
e.issues?.[0] &&
e.issues?.[0].code === 'invalid_type' &&