{"record":{"id":"8dbff6ff7c6e115b","repo":"FlowiseAI/Flowise","slug":"unknown-content-json-stringify-content","errorCode":null,"errorMessage":"Unknown content ${JSON.stringify(content)}","messagePattern":"Unknown content (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts","lineNumber":309,"sourceCode":"    } else if (\n        content.type?.includes('/') &&\n        content.type.split('/').length === 2 &&\n        'data' in content &&\n        typeof content.data === 'string'\n    ) {\n        return {\n            inlineData: {\n                mimeType: content.type,\n                data: content.data\n            }\n        }\n    } else if ('functionCall' in content) {\n        return undefined\n    } else {\n        if ('type' in content) {\n            throw new Error(`Unknown content type ${content.type}`)\n        } else {\n            throw new Error(`Unknown content ${JSON.stringify(content)}`)\n        }\n    }\n}\n\nexport function convertMessageContentToParts(\n    message: BaseMessage,\n    isMultimodalModel: boolean,\n    previousMessages: BaseMessage[],\n    model?: string\n): Part[] {\n    if (ToolMessage.isInstance(message)) {\n        const messageName = message.name ?? inferToolNameFromPreviousMessages(message, previousMessages)\n        if (messageName === undefined) {\n            throw new Error(\n                `Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage \"${message.id}\" from your passed messages. Please populate a \"name\" field on that ToolMessage explicitly.`\n            )\n        }\n","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts#L291-L327","documentation":"Thrown in _convertLangChainContentToPart (line 309) when a content block has NO 'type' field (and does not match the inline mimeType+data or functionCall shapes). It is the untyped fallback of the content dispatcher and includes the full JSON of the unrecognized block for diagnosis.","triggerScenarios":"A MessageContentComplex part lacks a 'type' key and is not a functionCall or inline-data shape.","commonSituations":"A raw object was placed in the content array without a type discriminator, or a serialization step stripped the type field.","solutions":["Add a valid 'type' field to the content part (e.g., 'text', 'image_url', 'media').","Ensure upstream serialization preserves the type discriminator.","Sanitize the content array to drop or repair untyped parts before the Gemini call."],"exampleFix":"// before (throws): { text: 'hello' }  // no type\n// after:           { type: 'text', text: 'hello' }","handlingStrategy":"validation","validationCode":"function hasTypeOrKnownShape(c: any): boolean {\n  if (!c || typeof c !== 'object') return false\n  if (typeof c.type === 'string') return true\n  if ('functionCall' in c) return true\n  if (typeof c.type === 'string' && typeof c.data === 'string') return true\n  return false\n}\nfor (const p of parts) {\n  if (!hasTypeOrKnownShape(p)) throw new Error('content part missing a recognized discriminator (type/functionCall)')\n}","typeGuard":"function isRecognizedContent(c: unknown): boolean {\n  if (typeof c !== 'object' || c === null) return false\n  const o = c as Record<string, unknown>\n  return typeof o.type === 'string' || 'functionCall' in o\n    || (typeof o.type === 'string' && typeof o.data === 'string')\n}","tryCatchPattern":"try {\n  return _convertLangChainContentToPart(part, isMultimodal)\n} catch (e) {\n  if (e instanceof Error && /Unknown content/.test(e.message)) {\n    // drop the untyped part or tag it with a valid type\n  }\n  throw e\n}","preventionTips":["Ensure every content part carries a 'type' discriminator.","Avoid pushing raw POJOs into message content arrays.","Validate content shape after any serialize/deserialize round-trip."],"tags":["gemini","content-blocks","validation","dispatch"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}