{"record":{"id":"91acf4ad104c6fde","repo":"FlowiseAI/Flowise","slug":"condition-variable-is-required","errorCode":null,"errorMessage":"Condition variable is required!","messagePattern":"Condition variable is required!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/sequentialagents/Condition/Condition.ts","lineNumber":297,"sourceCode":"    }\n\n    if (selectedTab === 'conditionFunction' && conditionFunction) {\n        const sandbox = createCodeExecutionSandbox(input, variables, flow)\n\n        try {\n            const response = await executeJavaScriptCode(conditionFunction, sandbox)\n\n            if (typeof response !== 'string') throw new Error('Condition function must return a string')\n            return response\n        } catch (e) {\n            throw new Error(e)\n        }\n    } else if (selectedTab === 'conditionUI' && conditionUI) {\n        try {\n            const conditionItems: IConditionGridItem[] = typeof conditionUI === 'string' ? JSON.parse(conditionUI) : conditionUI\n\n            for (const item of conditionItems) {\n                if (!item.variable) throw new Error('Condition variable is required!')\n\n                if (item.variable.startsWith('$flow')) {\n                    const variableValue = customGet(flow, item.variable.replace('$flow.', ''))\n                    if (checkCondition(variableValue, item.operation, item.value)) {\n                        return item.output\n                    }\n                } else if (item.variable.startsWith('$vars')) {\n                    const variableValue = customGet(flow, item.variable.replace('$', ''))\n                    if (checkCondition(variableValue, item.operation, item.value)) {\n                        return item.output\n                    }\n                } else if (item.variable.startsWith('$')) {\n                    const nodeId = item.variable.replace('$', '')\n\n                    const messageOutputs = ((state.messages as unknown as BaseMessage[]) ?? []).filter(\n                        (message) => message.additional_kwargs && message.additional_kwargs?.nodeId === nodeId\n                    )\n                    const messageOutput = messageOutputs[messageOutputs.length - 1]","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/Condition/Condition.ts#L279-L315","documentation":"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.","triggerScenarios":"Saving the conditionUI grid with one or more rows where the `variable` field is empty or missing.","commonSituations":"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`.","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."],"exampleFix":"// before\nconditionUI = '[{\"operation\":\">\",\"value\":\"18\"}]' // throws [293]\n\n// after\nconditionUI = '[{\"variable\":\"$flow.state.age\",\"operation\":\">\",\"value\":\"18\",\"output\":\"Approved\"}]'","handlingStrategy":"validation","validationCode":"function validateConditionGrid(items) {\n  const arr = typeof items === 'string' ? JSON.parse(items) : items\n  for (const [i, item] of arr.entries()) {\n    if (!item.variable) throw new Error(`Condition row ${i} is missing a 'variable'`)\n  }\n  return arr\n}\n\nvalidateConditionGrid(nodeData.inputs.conditionUI)","typeGuard":"function isConditionGridItem(v): v is IConditionGridItem {\n  return v != null && typeof v === 'object' && typeof (v as any).variable === 'string' && (v as any).variable.length > 0\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["condition","configuration","input-validation"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}