OpenBMB/ChatDev · warning · ValidationError
Source and target filenames must be different
Error message
Source and target filenames must be different
What it means
rename_workflow validates both filenames, then rejects the operation when the sanitized source and target are identical (case-insensitive/path-normalized equality after validate_workflow_filename). It is a client-input validation error, not a filesystem error.
Source
Thrown at server/services/workflow_storage.py:116
logger.log_exception(exc, f"Failed to save workflow file {safe_filename}")
raise WorkflowExecutionError(
"Failed to save workflow file", details={"filename": safe_filename}
)
logger.info(
"Workflow file persisted",
log_type=LogType.WORKFLOW,
filename=safe_filename,
action=action,
)
def rename_workflow(source_filename: str, target_filename: str, *, directory: Path) -> None:
source_safe = validate_workflow_filename(source_filename, require_yaml_extension=True)
target_safe = validate_workflow_filename(target_filename, require_yaml_extension=True)
if source_safe == target_safe:
raise ValidationError("Source and target filenames must be different", field="new_filename")
source_path = directory / source_safe
target_path = directory / target_safe
if not source_path.exists() or not source_path.is_file():
raise ResourceNotFoundError(
"Workflow file not found",
resource_type="workflow",
resource_id=source_safe,
)
if target_path.exists():
raise ResourceConflictError(
"Target workflow already exists",
resource_type="workflow",
resource_id=target_safe,
)
View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Skip the rename API call when new filename equals the old one in the UI
- Send a genuinely different target filename
- Check for leading/trailing whitespace or case-only differences that normalize to the same safe name
Example fix
# before
rename_workflow_file(sid, wf, new_name)
# after
if Path(wf).name != new_name:
rename_workflow_file(sid, wf, new_name) Defensive patterns
Strategy: validation
Validate before calling
if Path(filename).name == new_filename:
return # no-op rename, skip API call Try / catch
try:
rename_workflow_file(sid, name, new)
except ValidationError as e:
if e.field == 'new_filename':
notify_user('choose a different name') Prevention
- Disable submit in UI when names match
- Trim whitespace before comparing
- Remember sanitization may make names equal
When it happens
Trigger: Calling rename_workflow_file with new_filename equal to the current filename, or differing only in characters the sanitizer strips/normalizes (e.g. case or path segments).
Common situations: UI rename form pre-filled with the old name and submitted unchanged; client lowercases the filename before sending.
Related errors
- YAML root must be a mapping
- expected mapping
- expected string
- expected non-empty string
- Task prompt cannot be empty
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/5f34de0c6bbd9a31.
Report an issue: GitHub.