{"record":{"id":"2d039017dbe50539","repo":"infiniflow/ragflow","slug":"variableaggregator-variables-of-group-g-get-g","errorCode":null,"errorMessage":"[VariableAggregator] variables of group `{g.get('group_name')}` can not be empty","messagePattern":"\\[VariableAggregator\\] variables of group `(.+?)` can not be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/variable_aggregator.py","lineNumber":41,"sourceCode":"class VariableAggregatorParam(ComponentParamBase):\n    \"\"\"\n    Parameters for VariableAggregator\n\n    - groups: list of dicts {\"group_name\": str, \"variables\": [variable selectors]}\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        # each group expects: {\"group_name\": str, \"variables\": List[str]}\n        self.groups = []\n\n    def check(self):\n        self.check_empty(self.groups, \"[VariableAggregator] groups\")\n        for g in self.groups:\n            if not g.get(\"group_name\"):\n                raise ValueError(\"[VariableAggregator] group_name can not be empty!\")\n            if not g.get(\"variables\"):\n                raise ValueError(f\"[VariableAggregator] variables of group `{g.get('group_name')}` can not be empty\")\n            if not isinstance(g.get(\"variables\"), list):\n                raise ValueError(f\"[VariableAggregator] variables of group `{g.get('group_name')}` should be a list of strings\")\n\n    def get_input_form(self) -> dict[str, dict]:\n        return {\n            \"variables\": {\n                \"name\": \"Variables\",\n                \"type\": \"list\",\n            }\n        }\n\n\nclass VariableAggregator(ComponentBase):\n    component_name = \"VariableAggregator\"\n\n    @timeout(int(os.environ.get(\"COMPONENT_EXEC_TIMEOUT\", 3)))\n    def _invoke(self, **kwargs):\n        # Group mode: for each group, pick the first available variable","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/variable_aggregator.py#L23-L59","documentation":"ValueError from VariableAggregatorParam.check(): a group passes the group_name check but its 'variables' field is falsy (missing, None, or empty list). An aggregator group with nothing to aggregate is invalid.","triggerScenarios":"A groups entry {\"group_name\": \"g1\"} with no variables key, or \"variables\": [] after the user removed all selectors from a group.","commonSituations":"Creating a group ahead of wiring its members; upstream components deleted leaving selectors removed; DSL generation that emits the name but skips empty variable arrays.","solutions":["Add at least one variable selector to the group.","Remove the group entirely if it is no longer needed.","When generating canvases, skip emitting groups whose variables list is empty."],"exampleFix":"// before\n{\"group_name\": \"inputs\", \"variables\": []}\n\n// after\n{\"group_name\": \"inputs\", \"variables\": [\"begin@usr_q\"]}","handlingStrategy":"validation","validationCode":"for g in aggregator_param.groups:\n    assert g.get('variables'), f'group {g.get(\"group_name\")} has no variables'","typeGuard":"def group_has_variables(g: dict) -> bool:\n    return isinstance(g.get('variables'), list) and len(g['variables']) > 0","tryCatchPattern":"try:\n    aggregator_param.check()\nexcept ValueError as e:\n    if 'can not be empty' in str(e):\n        # add selectors to the group or remove the group\n        ...","preventionTips":["Add at least one variable selector per group before saving.","Skip emitting empty groups in canvas-generation scripts.","Remove groups when their member components are deleted."],"tags":["variable-aggregator","configuration","validation","agent-canvas"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}