{"record":{"id":"af73421ca6eea47c","repo":"FlowiseAI/Flowise","slug":"unsupported-source-type-block-source-type","errorCode":null,"errorMessage":"Unsupported source type: ${block.source_type}","messagePattern":"Unsupported source type: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts","lineNumber":161,"sourceCode":"                    }\n                } else {\n                    return {\n                        fileData: {\n                            mimeType: block.mime_type ?? '',\n                            fileUri: block.url\n                        }\n                    }\n                }\n            }\n            if (block.source_type === 'base64') {\n                return {\n                    inlineData: {\n                        mimeType: block.mime_type ?? '',\n                        data: block.data\n                    }\n                }\n            }\n            throw new Error(`Unsupported source type: ${block.source_type}`)\n        },\n\n        fromStandardAudioBlock(block): FileDataPart | InlineDataPart {\n            if (!isMultimodalModel) {\n                throw new Error('This model does not support audio')\n            }\n            if (block.source_type === 'url') {\n                const data = parseBase64DataUrl({ dataUrl: block.url })\n                if (data) {\n                    return {\n                        inlineData: {\n                            mimeType: data.mime_type,\n                            data: data.data\n                        }\n                    }\n                } else {\n                    return {\n                        fileData: {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts#L143-L179","documentation":"Thrown at the end of fromStandardImageBlock (line 161) after the only two recognized source_type values ('url' and 'base64') have been checked. Any other source_type for a standard image block reaches this terminal throw.","triggerScenarios":"A standard image content block whose source_type is neither 'url' nor 'base64' (e.g., 'file', 'path', 'stream', undefined-but-not-matching).","commonSituations":"A custom content producer invents a source_type, a schema migration renamed the field, or a DataContentBlock from another provider is passed through without normalization.","solutions":["Normalize image blocks to source_type 'url' (with block.url) or 'base64' (with block.data) before sending to the Gemini node.","Use LangChain's standard DataContentBlock helpers to construct blocks so the source_type is always valid.","Log block.source_type upstream to catch the offending producer."],"exampleFix":"// before (throws): { type:'image', source_type:'file', path:'/x.png' }\n// after:           { type:'image', source_type:'base64', mime_type:'image/png', data: base64String }","handlingStrategy":"validation","validationCode":"const ALLOWED_IMG_SOURCE = new Set(['url', 'base64'])\nfunction validImageSources(parts: any[]): boolean {\n  return parts.filter((p) => p?.type === 'image').every((p) => ALLOWED_IMG_SOURCE.has(p.source_type))\n}\nif (!validImageSources(allParts)) throw new Error('image blocks must use source_type url|base64')","typeGuard":"type StdImageBlock =\n  | { type: 'image'; source_type: 'url'; url: string; mime_type?: string }\n  | { type: 'image'; source_type: 'base64'; data: string; mime_type?: string }\nfunction isStdImageBlock(c: unknown): c is StdImageBlock {\n  if (typeof c !== 'object' || c === null || (c as any).type !== 'image') return false\n  const st = (c as any).source_type\n  return (st === 'url' && typeof (c as any).url === 'string')\n      || (st === 'base64' && typeof (c as any).data === 'string')\n}","tryCatchPattern":"try {\n  return convertToProviderContentBlock(block, converter)\n} catch (e) {\n  if (e instanceof Error && /Unsupported source type/.test(e.message)) {\n    // normalize block.source_type to 'url' or 'base64' and retry\n  }\n  throw e\n}","preventionTips":["Always build image blocks with LangChain DataContentBlock helpers so source_type is valid.","Reject blocks whose source_type is not in the allow-list at ingestion.","Add a producer-side contract test for content-block shapes."],"tags":["gemini","multimodal","content-blocks","images","validation"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}