FlowiseAI/Flowise · error · Error

Invalid JSON in the LLM Node's Prompt Input Values: ${except

Error message

Invalid JSON in the LLM Node's Prompt Input Values: ${exception}

What it means

The LLM Node's 'Prompt Input Values' field is JSON.parsed at init when it is a string. A malformed JSON string throws SyntaxError, which is caught and re-thrown with this prefix including the original exception.

Source

Thrown at packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts:419

        humanPrompt = transformBracesWithColon(humanPrompt)
        const llmNodeLabel = nodeData.inputs?.llmNodeName as string
        const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]
        const model = nodeData.inputs?.model as BaseChatModel
        const promptValuesStr = nodeData.inputs?.promptValues
        const output = nodeData.outputs?.output as string
        const llmStructuredOutput = nodeData.inputs?.llmStructuredOutput

        if (!llmNodeLabel) throw new Error('LLM Node name is required!')
        const llmNodeName = llmNodeLabel.toLowerCase().replace(/\s/g, '_').trim()

        if (!sequentialNodes || !sequentialNodes.length) throw new Error('Agent must have a predecessor!')

        let llmNodeInputVariablesValues: ICommonObject = {}
        if (promptValuesStr) {
            try {
                llmNodeInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)
            } catch (exception) {
                throw new Error("Invalid JSON in the LLM Node's Prompt Input Values: " + exception)
            }
        }
        llmNodeInputVariablesValues = handleEscapeCharacters(llmNodeInputVariablesValues, true)

        const startLLM = sequentialNodes[0].startLLM
        const llm = model || startLLM
        if (nodeData.inputs) nodeData.inputs.model = llm

        const multiModalMessageContent = sequentialNodes[0]?.multiModalMessageContent || (await processImageMessage(llm, nodeData, options))
        const abortControllerSignal = options.signal as AbortController
        const llmNodeInputVariables = uniq([...getInputVariables(systemPrompt), ...getInputVariables(humanPrompt)])

        const missingInputVars = difference(llmNodeInputVariables, Object.keys(llmNodeInputVariablesValues)).join(' ')
        const allVariablesSatisfied = missingInputVars.length === 0
        if (!allVariablesSatisfied) {
            const nodeInputVars = llmNodeInputVariables.join(' ')
            const providedInputVars = Object.keys(llmNodeInputVariablesValues).join(' ')

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Run the Prompt Input Values string through a JSON linter and fix the reported error.
  2. Use the structured prompt-values editor so the field stays a valid object.
  3. Confirm the value is an object mapping placeholder names to values, e.g. {"topic":"rag"}.

Example fix

// before (throws: trailing comma)
{"topic": "rag", "count": 3,}

// after
{"topic": "rag", "count": 3}
Defensive patterns

Strategy: validation

Validate before calling

function parsePromptValues(raw: unknown): Record<string, unknown> {
  if (!raw) return {}
  const obj = typeof raw === 'string' ? JSON.parse(raw) : raw
  if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) throw new Error('Prompt Input Values must be a JSON object')
  return obj as Record<string, unknown>
}

Type guard

const isPromptValuesObject = (x: any): x is Record<string, unknown> => typeof x === 'object' && x !== null && !Array.isArray(x)

Try / catch

try { JSON.parse(promptValuesStr) } catch (e) { throw new Error('Prompt Input Values JSON invalid: ' + e.message) }

Prevention

When it happens

Trigger: promptValuesStr is a non-empty string with a JSON syntax error: trailing comma, unquoted keys, smart quotes, single quotes, or truncation.

Common situations: Hand-typing the prompt-values JSON instead of using the structured editor; pasting from formatted text that introduced smart quotes; partial edit before testing.

Understand the failure class

Related errors


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