FlowiseAI/Flowise · error · Error

Unknown content type ${content.type}

Error message

Unknown content type ${content.type}

What it means

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.

Source

Thrown at packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts:307

            }
        }
    } else if (
        content.type?.includes('/') &&
        content.type.split('/').length === 2 &&
        'data' in content &&
        typeof content.data === 'string'
    ) {
        return {
            inlineData: {
                mimeType: content.type,
                data: content.data
            }
        }
    } else if ('functionCall' in content) {
        return undefined
    } else {
        if ('type' in content) {
            throw new Error(`Unknown content type ${content.type}`)
        } else {
            throw new Error(`Unknown content ${JSON.stringify(content)}`)
        }
    }
}

export function convertMessageContentToParts(
    message: BaseMessage,
    isMultimodalModel: boolean,
    previousMessages: BaseMessage[],
    model?: string
): Part[] {
    if (ToolMessage.isInstance(message)) {
        const messageName = message.name ?? inferToolNameFromPreviousMessages(message, previousMessages)
        if (messageName === undefined) {
            throw new Error(
                `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.`
            )

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Map the offending part to a supported type (text, image_url, media, tool_use, etc.) before it reaches Gemini.
  2. Filter out unsupported content types in the producing node.
  3. Inspect content.type at runtime to identify and fix the producer.

Example fix

// before (throws): { type: 'imag_url', image_url: {...} }  // typo
// after:           { type: 'image_url', image_url: {...} }
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED_TYPES = new Set([
  'text', 'executableCode', 'codeExecutionResult', 'image_url',
  'media', 'tool_use', 'tool_call'
])
function isKnownTypedBlock(c: any): boolean {
  if (!c || typeof c.type !== 'string') return true // untyped handled separately
  return ALLOWED_TYPES.has(c.type) || /\/./.test(c.type) // mime-type inline shape
}
for (const p of parts) {
  if (!isKnownTypedBlock(p)) throw new Error(`Unsupported content.type: ${p.type}`)
}

Type guard

function isKnownContentBlock(c: unknown): boolean {
  if (typeof c !== 'object' || c === null) return false
  const t = (c as any).type
  if (typeof t !== 'string') return 'functionCall' in (c as object)
  return ['text','executableCode','codeExecutionResult','image_url','media','tool_use','tool_call'].includes(t)
    || (t.includes('/') && t.split('/').length === 2)
}

Try / catch

try {
  return _convertLangChainContentToPart(part, isMultimodal)
} catch (e) {
  if (e instanceof Error && /Unknown content type/.test(e.message)) {
    // coerce or drop the unsupported typed block
  }
  throw e
}

Prevention

When it happens

Trigger: A MessageContentComplex part carries a 'type' value outside the supported set.

Common situations: A new/proprietary content type was introduced by an upstream node or tool, or a typo in the type field (e.g., 'imag_url').

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/796d0bae78e222e5. Report an issue: GitHub.