FlowiseAI/Flowise · error · Error
Invalid JSON in the Agent's Prompt Input Values: ${exception
Error message
Invalid JSON in the Agent's Prompt Input Values: ${exception} What it means
Thrown when the Agent's `promptValues` input is a string that fails `JSON.parse`. The block first short-circuits if promptValues is already an object (typeof === 'object'), so this error specifically means a malformed JSON string was supplied. The original parse exception is appended for diagnostics.
Source
Thrown at packages/components/nodes/sequentialagents/Agent/Agent.ts:490
const agentLabel = nodeData.inputs?.agentName as string
const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]
const maxIterations = nodeData.inputs?.maxIterations as string
const model = nodeData.inputs?.model as BaseChatModel
const promptValuesStr = nodeData.inputs?.promptValues
const output = nodeData.outputs?.output as string
const approvalPrompt = nodeData.inputs?.approvalPrompt as string
if (!agentLabel) throw new Error('Agent name is required!')
const agentName = agentLabel.toLowerCase().replace(/\s/g, '_').trim()
if (!sequentialNodes || !sequentialNodes.length) throw new Error('Agent must have a predecessor!')
let agentInputVariablesValues: ICommonObject = {}
if (promptValuesStr) {
try {
agentInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)
} catch (exception) {
throw new Error("Invalid JSON in the Agent's Prompt Input Values: " + exception)
}
}
agentInputVariablesValues = handleEscapeCharacters(agentInputVariablesValues, 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 agentInputVariables = uniq([...getInputVariables(agentSystemPrompt), ...getInputVariables(agentHumanPrompt)])
if (!agentInputVariables.every((element) => Object.keys(agentInputVariablesValues).includes(element))) {
throw new Error('Agent input variables values are not provided!')
}
const interrupt = nodeData.inputs?.interrupt as boolean
View on GitHub (pinned to abe4a8601a)
Solutions
- Replace the value with a valid JSON object string, e.g. `{"customerName":"Alice"}`.
- If building the value programmatically, pass the parsed object directly so the `typeof === 'object'` branch skips JSON.parse.
- Strip smart quotes and verify the string in a browser console with `JSON.parse(value)` before saving the node.
- Ensure keys are double-quoted and there are no trailing commas.
Example fix
// before
nodeData.inputs.promptValues = "name: Alice, age: 30" // throws [281]
// after
nodeData.inputs.promptValues = '{"name":"Alice","age":30}'
// or pass object directly
nodeData.inputs.promptValues = { name: 'Alice', age: 30 } Defensive patterns
Strategy: validation
Validate before calling
function parsePromptValuesSafe(raw) {
if (raw == null) return {}
if (typeof raw === 'object') return raw
try {
const parsed = JSON.parse(raw)
if (typeof parsed !== 'object' || Array.isArray(parsed) || parsed === null) {
throw new Error('Prompt Input Values must be a JSON object, not an array or primitive.')
}
return parsed
} catch (e) {
throw new Error(`Prompt Input Values is not valid JSON: ${e.message}`)
}
}
const agentInputVariablesValues = parsePromptValuesSafe(nodeData.inputs.promptValues) Type guard
function isJsonObjectString(s): s is string {
if (typeof s !== 'string') return false
try { return typeof JSON.parse(s) === 'object' && !Array.isArray(JSON.parse(s)) }
catch { return false }
} Prevention
- Always use double-quoted keys in promptValues JSON.
- Paste values through a JSON linter before saving.
- Pass parsed objects directly when calling init from code to skip JSON.parse entirely.
When it happens
Trigger: Calling Agent.init with `nodeData.inputs.promptValues` set to a non-empty string that is not valid JSON — e.g. `"color: blue"`, `"'key':'val'"`, or text containing smart quotes / trailing commas.
Common situations: User typed free-form text into the Prompt Input Values field instead of a JSON object; copy-pasted from Word/Slack/Notion which converted straight quotes to curly quotes; left a trailing comma; used single quotes around keys; mixed JSON with Flowise templating syntax.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid JSON in the Condition Agent's Prompt Input Values: $
- Agent input variables values are not provided!
- Condition Agent input variables values are not provided!
- Invalid JSON in the Chat NVIDIA NIM's baseOptions: ${excepti
- Invalid JSON in the ChatOpenAI's BaseOptions: ${exception}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/2c5b31153935e428.
Report an issue: GitHub.