FlowiseAI/Flowise · error · Error
Condition variable is required!
Error message
Condition variable is required!
What it means
ConditionAgent analog of error 293. On the `conditionUI` grid branch the loop's first check is `if (!item.variable)`; a row without a variable cannot be evaluated, so the loop throws immediately.
Source
Thrown at packages/components/nodes/sequentialagents/ConditionAgent/ConditionAgent.ts:566
}
if (selectedTab === 'conditionFunction' && conditionFunction) {
const sandbox = createCodeExecutionSandbox(input, variables, flow)
try {
const response = await executeJavaScriptCode(conditionFunction, sandbox)
if (typeof response !== 'string') throw new Error('Condition function must return a string')
return response
} catch (e) {
throw new Error(e)
}
} else if (selectedTab === 'conditionUI' && conditionUI) {
try {
const conditionItems: IConditionGridItem[] = typeof conditionUI === 'string' ? JSON.parse(conditionUI) : conditionUI
for (const item of conditionItems) {
if (!item.variable) throw new Error('Condition variable is required!')
if (item.variable.startsWith('$flow')) {
const variableValue = customGet(flow, item.variable.replace('$flow.', ''))
if (checkCondition(variableValue, item.operation, item.value)) {
return item.output
}
} else if (item.variable.startsWith('$vars')) {
const variableValue = customGet(flow, item.variable.replace('$', ''))
if (checkCondition(variableValue, item.operation, item.value)) {
return item.output
}
} else if (item.variable.startsWith('$')) {
const nodeId = item.variable.replace('$', '')
const messageOutputs = ((state.messages as unknown as BaseMessage[]) ?? []).filter(
(message) => message.additional_kwargs && message.additional_kwargs?.nodeId === nodeId
)
const messageOutput = messageOutputs[messageOutputs.length - 1]View on GitHub (pinned to abe4a8601a)
Solutions
- Set a non-empty variable (e.g. `$flow.state.score`) for every row.
- Remove incomplete rows before saving.
- Prefer the visual grid editor over raw JSON.
Example fix
// before
conditionUI = '[{"operation":">","value":"0.5","output":"Positive"}]' // throws [299]
// after
conditionUI = '[{"variable":"$flow.state.score","operation":">","value":"0.5","output":"Positive"}]' Defensive patterns
Strategy: validation
Validate before calling
function validateConditionGrid(items) {
const arr = typeof items === 'string' ? JSON.parse(items) : items
for (const [i, item] of arr.entries()) {
if (!item.variable) throw new Error(`Condition row ${i} is missing a 'variable'`)
}
return arr
}
validateConditionGrid(nodeData.inputs.conditionUI) Type guard
function isConditionGridItem(v): v is IConditionGridItem {
return v != null && typeof v === 'object' && typeof (v as any).variable === 'string' && (v as any).variable.length > 0
} Prevention
- Use the visual grid editor so the variable field is enforced.
- Remove incomplete rows before saving.
- When editing JSON directly, ensure every object has a `variable` key.
When it happens
Trigger: Saving the Condition Agent's conditionUI grid with a row where the `variable` field is empty or missing.
Common situations: User added a row but did not pick a variable; duplicated a row and cleared the variable; edited raw JSON and omitted the field.
Related errors
- Condition variable is required!
- Invalid JSON in the Agent's Prompt Input Values: ${exception
- Agent input variables values are not provided!
- Key is required
- Condition function must return a string
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/a2a1c066810eaa68.
Report an issue: GitHub.