{"record":{"id":"a3389fd279b2f59d","repo":"infiniflow/ragflow","slug":"component-name-e","errorCode":null,"errorMessage":"{component_name}: {e}","messagePattern":"\\{component_name\\}: \\{e\\}","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/canvas.py","lineNumber":122,"sourceCode":"        for cpn in self.components.values():\n            cpn[\"obj\"][\"params\"][\"custom_header\"] = self.custom_header\n\n        component_params = self.validate_component_parameters(self.dsl)\n        for k, cpn in self.components.items():\n            cpn[\"obj\"] = component_class(cpn[\"obj\"][\"component_name\"])(self, k, component_params[k])\n\n        self.path = self.dsl[\"path\"]\n\n    @staticmethod\n    def validate_component_parameters(dsl):\n        component_params = {}\n        for k, cpn in dsl[\"components\"].items():\n            param = component_class(cpn[\"obj\"][\"component_name\"] + \"Param\")()\n            param.update(cpn[\"obj\"][\"params\"])\n            try:\n                param.check()\n            except Exception as e:\n                raise ValueError(Graph._get_component_name(dsl, k) + f\": {e}\")\n            component_params[k] = param\n        return component_params\n\n    def __str__(self):\n        self.dsl[\"path\"] = self.path\n        self.dsl[\"task_id\"] = self.task_id\n        dsl = {\"components\": {}}\n        for k in self.dsl.keys():\n            if k in [\"components\"]:\n                continue\n            try:\n                dsl[k] = deepcopy(self.dsl[k])\n            except Exception as e:\n                logging.warning(\"Graph.__str__: deepcopy failed for dsl key '%s' (type=%s): %s. Using shallow reference.\", k, type(self.dsl[k]).__name__, e)\n                dsl[k] = self.dsl[k]\n\n        for k, cpn in self.components.items():\n            if k not in dsl[\"components\"]:","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/canvas.py#L104-L140","documentation":"During canvas (agent workflow) construction, every component's parameters are instantiated and their check() method runs. Any exception from a component's parameter validation is re-raised as ValueError prefixed with the human-readable component name from the DSL graph, so the user knows which node failed.","triggerScenarios":"Building a Graph/Canvas from a DSL whose component params fail param.check() — e.g. an LLM component with empty model name, a retrieval component with bad top_n, or any of the check_* validators in agent/component/base.py failing for that component's params.","commonSituations":"Hand-edited or programmatically generated workflow JSON with invalid parameter values; templates authored against an older component API; importing a canvas exported from another instance with different component versions; frontend allowing invalid values into saved params.","solutions":["The prefix before the colon is the component's display name — open that node in the canvas editor and fix the parameter named in the trailing message.","If the DSL is generated code, validate each component's params with a dry-run param.check() before saving.","Re-export the workflow from a known-good instance if it was hand-edited beyond repair.","After upgrading, re-open and re-save old canvases in the UI so components re-serialize with current param shapes."],"exampleFix":"# before (dsl params)\n{\"component_name\": \"Generation\", \"params\": {\"llm_id\": \"\", \"temperature\": 5}}\n\n# after\n{\"component_name\": \"Generation\", \"params\": {\"llm_id\": \"my_llm@openai\", \"temperature\": 0.7}}","handlingStrategy":"try-catch","validationCode":"def lint_canvas(dsl):\n    from agent.canvas import Canvas\n    try:\n        Canvas.validate_component_parameters(dsl)\n        return True\n    except ValueError as e:\n        print(f'invalid canvas: {e}')\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    graph = Graph(dsl)\nexcept ValueError as e:\n    # message is '<component name>: <inner validation error>'\n    comp, _, detail = str(e).partition(': ')\n    report_to_user(comp, detail)\n    raise","preventionTips":["Validate the DSL with validate_component_parameters before persisting or running it.","Use the canvas UI rather than hand-editing JSON for parameter changes.","Re-open and re-save old workflows after component upgrades."],"tags":["canvas","workflow","parameter-validation","dsl"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}