infiniflow/ragflow · error · ValueError
Loop Variable is not complete.
Error message
Loop Variable is not complete.
What it means
ValueError raised at the start of the Loop component's execution. Each entry in loop_variables is checked by _is_incomplete_loop_variable; if an entry lacks required fields (e.g. missing variable name, value, input_mode, or type), the loop refuses to run.
Source
Thrown at agent/component/loop.py:80
return cls._is_missing_required_field(item.get("value"))
if input_mode == "constant":
return item.get("value") is None
return True
def get_start(self):
for cid in self._canvas.components.keys():
if self._canvas.get_component(cid)["obj"].component_name.lower() != "loopitem":
continue
if self._canvas.get_component(cid)["parent_id"] == self._id:
return cid
def _invoke(self, **kwargs):
if self.check_if_canceled("Loop processing"):
return
for item in self._param.loop_variables:
if self._is_incomplete_loop_variable(item):
raise ValueError("Loop Variable is not complete.")
if item["input_mode"] == "variable":
self.set_output(item["variable"], self._canvas.get_variable_value(item["value"]))
elif item["input_mode"] == "constant":
self.set_output(item["variable"], item["value"])
else:
if item["type"] == "number":
self.set_output(item["variable"], 0)
elif item["type"] == "string":
self.set_output(item["variable"], "")
elif item["type"] == "boolean":
self.set_output(item["variable"], False)
elif item["type"].startswith("object"):
self.set_output(item["variable"], {})
elif item["type"].startswith("array"):
self.set_output(item["variable"], [])
else:
self.set_output(item["variable"], "")
View on GitHub (pinned to 554fb1133a)
Solutions
- Open the Loop component config and complete every loop variable row: name, type, input_mode, and value (or variable selector).
- Inspect the canvas JSON (loop_variables array) and fill in or remove entries with missing keys.
- After importing a template, re-save the Loop component once so the current schema fills defaults.
Example fix
// before (canvas JSON)
"loop_variables": [{"variable": "counter", "input_mode": "constant"}]
// after
"loop_variables": [{"variable": "counter", "type": "number", "input_mode": "constant", "value": 0}] Defensive patterns
Strategy: validation
Validate before calling
required = {"variable", "input_mode", "type"}
for item in loop_param.loop_variables:
missing = required - set(item)
assert not missing, f'loop variable incomplete, missing: {missing}' Type guard
def loop_variable_complete(item: dict) -> bool:
return bool(item.get('variable')) and item.get('input_mode') in {'variable', 'constant'} and 'type' in item Try / catch
try:
loop._invoke()
except ValueError as e:
if 'not complete' in str(e):
# re-open config, complete rows, re-save
... Prevention
- Complete every loop-variable row (name, type, mode, value) before saving.
- Re-save Loop components after importing templates to backfill new required fields.
- Audit canvas JSON for partially-filled variable entries after bulk edits.
When it happens
Trigger: A loop_variables item in the canvas JSON missing keys such as 'variable', 'value', or 'input_mode'; an entry left half-configured in the UI (variable selected but value empty in constant mode); importing a canvas where variables were partially migrated.
Common situations: Duplicating a Loop component and deleting a field in the copy; older canvas JSON saved before a required field was introduced; frontend bug saving incomplete rows.
Related errors
- Loop condition is incomplete.
- Invalid operator: {operator}
- Invalid input mode.
- Invalid logical operator,should be 'and' or 'or'.
- [VariableAggregator] group_name can not be empty!
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/31208041794d6b69.
Report an issue: GitHub.