{"record":{"id":"796d0bae78e222e5","repo":"FlowiseAI/Flowise","slug":"unknown-content-type-content-type","errorCode":null,"errorMessage":"Unknown content type ${content.type}","messagePattern":"Unknown content type (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts","lineNumber":307,"sourceCode":"            }\n        }\n    } 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            )","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts#L289-L325","documentation":"Thrown in _convertLangChainContentToPart (line 307) when a content block has a 'type' field that matches none of the recognized types (text, executableCode, codeExecutionResult, image_url, media, tool_use, tool_call, mimeType+data inline, functionCall). It is the typed-branch fallback of the content dispatcher.","triggerScenarios":"A MessageContentComplex part carries a 'type' value outside the supported set.","commonSituations":"A new/proprietary content type was introduced by an upstream node or tool, or a typo in the type field (e.g., 'imag_url').","solutions":["Map the offending part to a supported type (text, image_url, media, tool_use, etc.) before it reaches Gemini.","Filter out unsupported content types in the producing node.","Inspect content.type at runtime to identify and fix the producer."],"exampleFix":"// before (throws): { type: 'imag_url', image_url: {...} }  // typo\n// after:           { type: 'image_url', image_url: {...} }","handlingStrategy":"validation","validationCode":"const ALLOWED_TYPES = new Set([\n  'text', 'executableCode', 'codeExecutionResult', 'image_url',\n  'media', 'tool_use', 'tool_call'\n])\nfunction isKnownTypedBlock(c: any): boolean {\n  if (!c || typeof c.type !== 'string') return true // untyped handled separately\n  return ALLOWED_TYPES.has(c.type) || /\\/./.test(c.type) // mime-type inline shape\n}\nfor (const p of parts) {\n  if (!isKnownTypedBlock(p)) throw new Error(`Unsupported content.type: ${p.type}`)\n}","typeGuard":"function isKnownContentBlock(c: unknown): boolean {\n  if (typeof c !== 'object' || c === null) return false\n  const t = (c as any).type\n  if (typeof t !== 'string') return 'functionCall' in (c as object)\n  return ['text','executableCode','codeExecutionResult','image_url','media','tool_use','tool_call'].includes(t)\n    || (t.includes('/') && t.split('/').length === 2)\n}","tryCatchPattern":"try {\n  return _convertLangChainContentToPart(part, isMultimodal)\n} catch (e) {\n  if (e instanceof Error && /Unknown content type/.test(e.message)) {\n    // coerce or drop the unsupported typed block\n  }\n  throw e\n}","preventionTips":["Filter content arrays to known types before sending to Gemini.","Map proprietary content types to a supported type at the producer.","Add regression tests covering every content type your chatflow emits."],"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"}