FlowiseAI/Flowise · error · Error

Invalid JSON in the Condition Agent's Prompt Input Values: $

Error message

Invalid JSON in the Condition Agent's Prompt Input Values: ${exception}

What it means

Same JSON-parse guard as error 281 but on the ConditionAgent node. When `promptValuesStr` is a non-empty string and `JSON.parse` throws, the exception is wrapped with the Condition Agent-specific prefix.

Source

Thrown at packages/components/nodes/sequentialagents/ConditionAgent/ConditionAgent.ts:416

        agentPrompt = transformBracesWithColon(agentPrompt)
        let humanPrompt = nodeData.inputs?.humanMessagePrompt as string
        humanPrompt = transformBracesWithColon(humanPrompt)
        const promptValuesStr = nodeData.inputs?.promptValues
        const conditionAgentStructuredOutput = nodeData.inputs?.conditionAgentStructuredOutput
        const model = nodeData.inputs?.model as BaseChatModel

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

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

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

        const conditionAgentInputVariables = uniq([...getInputVariables(agentPrompt), ...getInputVariables(humanPrompt)])

        if (!conditionAgentInputVariables.every((element) => Object.keys(conditionAgentInputVariablesValues).includes(element))) {
            throw new Error('Condition Agent input variables values are not provided!')
        }

        const abortControllerSignal = options.signal as AbortController

        const conditionalEdge = async (state: ISeqAgentsState, config: RunnableConfig) =>
            await runCondition(
                conditionName,
                nodeData,
                input,
                options,

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Provide a valid JSON object string, e.g. `{"topic":"sports"}`.
  2. Pass the value as an already-parsed object so the `typeof === 'object'` branch skips JSON.parse.
  3. Verify with `JSON.parse(value)` in a console before saving.

Example fix

// before
nodeData.inputs.promptValues = "topic: sports" // throws [296]

// after
nodeData.inputs.promptValues = '{"topic":"sports"}'
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('Condition Agent promptValues must be a JSON object.')
    }
    return parsed
  } catch (e) {
    throw new Error(`Condition Agent promptValues is not valid JSON: ${e.message}`)
  }
}

parsePromptValuesSafe(nodeData.inputs.promptValues)

Type guard

function isJsonObjectString(s): s is string {
  if (typeof s !== 'string') return false
  try { const v = JSON.parse(s); return typeof v === 'object' && v !== null && !Array.isArray(v) }
  catch { return false }
}

Prevention

When it happens

Trigger: Calling ConditionAgent.init with `nodeData.inputs.promptValues` set to a string that is not valid JSON.

Common situations: User typed free-form text in the Condition Agent's Prompt Input Values; pasted content with smart quotes; single-quoted keys; trailing commas.

Understand the failure class

Related errors


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