FlowiseAI/Flowise · error · Error
Condition variable is required!
Error message
Condition variable is required!
What it means
On the `conditionUI` grid branch, each row is evaluated by reading its `variable`, `operation`, and `value`. The first check inside the loop is `if (!item.variable)` — a row with no variable cannot be evaluated at all, so the loop aborts immediately.
Source
Thrown at packages/components/nodes/sequentialagents/Condition/Condition.ts:297
}
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.x` or `$vars.y`) for every row in the conditionUI grid.
- Remove empty/incomplete rows before saving.
- Use the visual picker rather than editing raw JSON so the field is enforced.
Example fix
// before
conditionUI = '[{"operation":">","value":"18"}]' // throws [293]
// after
conditionUI = '[{"variable":"$flow.state.age","operation":">","value":"18","output":"Approved"}]' 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 conditionUI grid with one or more rows where the `variable` field is empty or missing.
Common situations: User added a condition row but did not pick a variable from the dropdown; duplicated a row and cleared the variable; edited the grid JSON directly and omitted `variable`.
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/91acf4ad104c6fde.
Report an issue: GitHub.