infiniflow/ragflow · error · GroupValidationError
A compilation template named '{name}' already exists. Please
Error message
A compilation template named '{name}' already exists. Please choose a different name. What it means
GroupValidationError from _insert_child when a VALID non-builtin template with the same name already exists in the same tenant and group. Functionally the DB duplicate check of error 444, but on the pure insert path (creating a brand-new child row).
Source
Thrown at api/db/services/compilation_template_group_service.py:425
index: int,
) -> str:
kind = str((child or {}).get("kind") or "").strip()
name = str((child or {}).get("name") or "").strip()
config = (child or {}).get("config") or {}
if not kind or not name or not isinstance(config, dict):
raise GroupValidationError("Each template must include a name, kind, and config object.")
from api.db.services.compilation_template_service import CompilationTemplateService
config = CompilationTemplateService.fill_config_default_llm(config, tenant_id)
duplicate = CompilationTemplate.select().where(
CompilationTemplate.tenant_id == tenant_id,
CompilationTemplate.group_id == group_id,
CompilationTemplate.name == name,
~CompilationTemplate.is_builtin,
CompilationTemplate.status == StatusEnum.VALID.value,
)
if duplicate.exists():
raise GroupValidationError(f"A compilation template named '{name}' already exists. Please choose a different name.")
template_id = get_uuid()
CompilationTemplate.create(
id=template_id,
tenant_id=tenant_id,
group_id=group_id,
name=name,
description=str((child or {}).get("description") or ""),
kind=kind,
config=config,
is_builtin=False,
status=StatusEnum.VALID.value,
)
return template_id
@classmethod
def _purge_stale_invalid_children(cls, tenant_id: str, names: list[str]) -> None:
cleaned_names = [name for name in {str(name).strip() for name in names} if name]View on GitHub (pinned to 554fb1133a)
Solutions
- Pick a unique name for the new template.
- Before insert, query the group's templates and use a name that is free.
- If the row exists from a previous partial save, update it instead of inserting a duplicate.
Example fix
// before
name = "Tree" # already exists in group
// after
existing = {t.name for t in group_templates}
name = "Tree" if "Tree" not in existing else "Tree (new)" Defensive patterns
Strategy: validation
Validate before calling
existing = {t['name'] for t in fetch_group_templates(group_id)}
if name in existing:
name = uniquify(name, existing) # e.g. append ' (2)', ' (3)'... Prevention
- Make insert flows idempotent: check-then-insert keyed by name.
- After a failed save, verify whether rows committed before retrying.
When it happens
Trigger: Calling the add-child/insert path with a name that already exists among the group's VALID non-builtin templates.
Common situations: Re-adding a template after a partially failed save left the row committed; retrying an insert whose first attempt succeeded server-side but failed client-side; scripted seeding run twice.
Related errors
- Template name '{name}' is duplicated in this group.
- Template name '{name}' already exists. Please choose another
- Only one tree template in a group may enable re-chunking.
- Template {child_id} does not belong to this group.
- Each template must include a name, kind, and config object.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/bdad2d29b4407477.
Report an issue: GitHub.