{"record":{"id":"a2a1c066810eaa68","repo":"FlowiseAI/Flowise","slug":"condition-variable-is-required-a2a1c0","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/ConditionAgent/ConditionAgent.ts","lineNumber":566,"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":548,"sourceCodeEnd":584,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/ConditionAgent/ConditionAgent.ts#L548-L584","documentation":"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.","triggerScenarios":"Saving the Condition Agent's conditionUI grid with a row where the `variable` field is empty or missing.","commonSituations":"User added a row but did not pick a variable; duplicated a row and cleared the variable; edited raw JSON and omitted the field.","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."],"exampleFix":"// before\nconditionUI = '[{\"operation\":\">\",\"value\":\"0.5\",\"output\":\"Positive\"}]' // throws [299]\n\n// after\nconditionUI = '[{\"variable\":\"$flow.state.score\",\"operation\":\">\",\"value\":\"0.5\",\"output\":\"Positive\"}]'","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"}