infiniflow/ragflow · error · ValueError
[Categorize] Category name can not be empty!
Error message
[Categorize] Category name can not be empty!
What it means
Raised by CategorizeParam.check (agent/component/categorize.py) when iterating category_description and a dictionary key is empty/falsy. Each category entry needs a non-empty name because the name is used in the LLM prompt ('USER: ... → <name>') and as the routing label for downstream components.
Source
Thrown at agent/component/categorize.py:48
class CategorizeParam(LLMParam):
"""
Define the categorize component parameters.
"""
def __init__(self):
super().__init__()
self.category_description = {}
self.query = "sys.query"
self.message_history_window_size = 1
self.update_prompt()
def check(self):
if not isinstance(self.message_history_window_size, int) or self.message_history_window_size < 0:
raise ValueError("[Categorize] Message window size cannot be negative")
self.check_empty(self.category_description, "[Categorize] Category examples")
for k, v in self.category_description.items():
if not k:
raise ValueError("[Categorize] Category name can not be empty!")
if not v.get("to"):
raise ValueError(f"[Categorize] 'To' of category {k} can not be empty!")
def get_input_form(self) -> dict[str, dict]:
return {"query": {"type": "line", "name": "Query"}}
def update_prompt(self):
cate_lines = []
for c, desc in self.category_description.items():
for line in desc.get("examples", []):
if not line:
continue
cate_lines.append('USER: "' + re.sub(r"\n", " ", line, flags=re.DOTALL) + '" → ' + c)
descriptions = []
for c, desc in self.category_description.items():
if desc.get("description"):
descriptions.append("\n------\nCategory: {}\nDescription: {}".format(c, desc["description"]))View on GitHub (pinned to 554fb1133a)
Solutions
- Give every category a non-empty, distinct name in the Categorize component editor
- Remove fully empty category rows instead of leaving blank ones
- When generating canvases programmatically, filter out empty keys: {k: v for k, v in cats.items() if k}
Example fix
# before
"category_description": {"": {"examples": [...], "to": "x"}}
# after
"category_description": {"complaint": {"examples": [...], "to": "x"}} Defensive patterns
Strategy: validation
Validate before calling
categories = {k: v for k, v in raw_categories.items() if k and k.strip()}
if not categories:
raise ValueError('Categorize needs at least one named category')
param.category_description = categories Type guard
def has_no_empty_category_names(categories: dict) -> bool:
return all(str(k).strip() for k in categories) Try / catch
try:
param.check()
except ValueError as e:
if 'Category name can not be empty' in str(e):
param.category_description = {k: v for k, v in param.category_description.items() if k}
else:
raise Prevention
- Trim category names on save in the UI
- Delete blank category rows instead of leaving them
- When generating canvases programmatically, filter empty keys from category_description
When it happens
Trigger: In the Categorize component's category configuration, adding a category row and leaving its name blank; or canvas JSON where a category_description entry has "" as key. Fires during check() on save or run.
Common situations: UI allowing an empty name to be saved; hand-edited canvas JSON; renaming a category to empty while its examples and 'to' remain; copy-paste artifacts creating an empty key.
Related errors
- [Categorize] Message window size cannot be negative
- {} not supported, should be a float number in range [0, 1]
- [Categorize] 'To' of category {k} can not be empty!
- [DocGenerator] Font size must be greater than or equal to 12
- main() must return a value. Use null for an empty result.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/fbfb55f4b76e9312.
Report an issue: GitHub.