{"record":{"id":"f30dd4dedfe52014","repo":"FlowiseAI/Flowise","slug":"there-was-a-problem-parsing-your-system-message-p","errorCode":null,"errorMessage":"There was a problem parsing your system message. Please try a prompt without one.","messagePattern":"There was a problem parsing your system message\\. Please try a prompt without one\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts","lineNumber":431,"sourceCode":"                throw new Error('Unsupported message input')\n            }\n            const author = getMessageAuthor(message)\n            if (author === 'system' && index !== 0) {\n                throw new Error('System message should be the first one')\n            }\n            const role = convertAuthorToRole(author)\n\n            const prevContent = acc.content[acc.content.length]\n            if (!acc.mergeWithPreviousContent && prevContent && prevContent.role === role) {\n                throw new Error('Google Generative AI requires alternate messages between authors')\n            }\n\n            const parts = convertMessageContentToParts(message, isMultimodalModel, messages.slice(0, index), model)\n\n            if (acc.mergeWithPreviousContent) {\n                const prevContent = acc.content[acc.content.length - 1]\n                if (!prevContent) {\n                    throw new Error('There was a problem parsing your system message. Please try a prompt without one.')\n                }\n                prevContent.parts.push(...parts)\n\n                return {\n                    mergeWithPreviousContent: false,\n                    content: acc.content\n                }\n            }\n            let actualRole = role\n            if (actualRole === 'function' || (actualRole === 'system' && !convertSystemMessageToHumanContent)) {\n                actualRole = 'user'\n            }\n            const content: Content = {\n                role: actualRole,\n                parts\n            }\n            return {\n                mergeWithPreviousContent: author === 'system' && !convertSystemMessageToHumanContent,","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts#L413-L449","documentation":"When the reducer has flagged mergeWithPreviousContent (e.g. a system message being merged into the prior content), it looks up acc.content[acc.content.length - 1]. If that entry is unexpectedly undefined, the system-message merge has no target and Flowise throws this user-facing message. It signals a malformed message sequence where a merge was requested but there is nothing to merge into.","triggerScenarios":"The very first message in the array is a system message while convertSystemMessageToHumanContent logic has set mergeWithPreviousContent=true, leaving acc.content empty when the lookup occurs. Also reachable when a system message follows a sequence that produced an empty content array.","commonSituations":"A chatflow whose first node is a SystemMessage paired with a setting that converts system to human content; misconfigured system-message handling after a memory clear; edge case where a leading system message and the alternate-messages check interact to leave content empty before merge.","solutions":["Try the prompt without a system message (as the message text itself suggests) — use a HumanMessage with the same instructions instead.","Ensure at least one non-system message precedes any merge-triggering system message, or move the system message to index 0.","Toggle convertSystemMessageToHumanContent off in the node config to avoid the merge path entirely.","Update FlowiseComponents — older builds had bugs in the system-merge branch that produced empty content arrays."],"exampleFix":"// before\nmessages = [systemMsg] // merge path with empty acc.content -> throws [82]\n\n// after\n// drop the system message and fold its text into the first human message\nmessages = [new HumanMessage(systemMsg.content + '\\n\\n' + firstHuman.content)]","handlingStrategy":"validation","validationCode":"function safeForSystemMerge(messages) {\n  // If a system message exists and convertSystemMessageToHumanContent is on,\n  // ensure there is at least one non-system message before it OR it is at index 0.\n  const nonSys = messages.filter(m => getMessageAuthor(m) !== 'system')\n  if (nonSys.length === 0 && messages.some(m => getMessageAuthor(m) === 'system')) {\n    throw new Error('Refusing to send system-only payload to Google merge path')\n  }\n}","typeGuard":"function hasOnlySystemMessages(messages: unknown[]): boolean {\n  return messages.length > 0 && messages.every(m => getMessageAuthor(m) === 'system')\n}","tryCatchPattern":"try {\n  await model.invoke(messages)\n} catch (e) {\n  if (e.message.includes('parsing your system message')) {\n    const folded = new HumanMessage(messages[0].content)\n    await model.invoke([folded, ...messages.slice(1)])\n  } else throw e\n}","preventionTips":["Avoid leading a payload with a lone system message when system-to-human conversion is enabled.","Disable convertSystemMessageToHumanContent if you do not need it.","Keep FlowiseComponents updated — this code path has had bugs.","Smoke-test each chatflow after changing system-message handling settings."],"tags":["google-generative-ai","system-prompt","merge","gemini","edge-case"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}