{"record":{"id":"5f34de0c6bbd9a31","repo":"OpenBMB/ChatDev","slug":"source-and-target-filenames-must-be-different","errorCode":null,"errorMessage":"Source and target filenames must be different","messagePattern":"Source and target filenames must be different","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"warning","filePath":"server/services/workflow_storage.py","lineNumber":116,"sourceCode":"        logger.log_exception(exc, f\"Failed to save workflow file {safe_filename}\")\n        raise WorkflowExecutionError(\n            \"Failed to save workflow file\", details={\"filename\": safe_filename}\n        )\n\n    logger.info(\n        \"Workflow file persisted\",\n        log_type=LogType.WORKFLOW,\n        filename=safe_filename,\n        action=action,\n    )\n\n\ndef rename_workflow(source_filename: str, target_filename: str, *, directory: Path) -> None:\n    source_safe = validate_workflow_filename(source_filename, require_yaml_extension=True)\n    target_safe = validate_workflow_filename(target_filename, require_yaml_extension=True)\n\n    if source_safe == target_safe:\n        raise ValidationError(\"Source and target filenames must be different\", field=\"new_filename\")\n\n    source_path = directory / source_safe\n    target_path = directory / target_safe\n\n    if not source_path.exists() or not source_path.is_file():\n        raise ResourceNotFoundError(\n            \"Workflow file not found\",\n            resource_type=\"workflow\",\n            resource_id=source_safe,\n        )\n\n    if target_path.exists():\n        raise ResourceConflictError(\n            \"Target workflow already exists\",\n            resource_type=\"workflow\",\n            resource_id=target_safe,\n        )\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/services/workflow_storage.py#L98-L134","documentation":"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.","triggerScenarios":"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).","commonSituations":"UI rename form pre-filled with the old name and submitted unchanged; client lowercases the filename before sending.","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"],"exampleFix":"# before\nrename_workflow_file(sid, wf, new_name)\n# after\nif Path(wf).name != new_name:\n    rename_workflow_file(sid, wf, new_name)","handlingStrategy":"validation","validationCode":"if Path(filename).name == new_filename:\n    return  # no-op rename, skip API call","typeGuard":null,"tryCatchPattern":"try:\n    rename_workflow_file(sid, name, new)\nexcept ValidationError as e:\n    if e.field == 'new_filename':\n        notify_user('choose a different name')","preventionTips":["Disable submit in UI when names match","Trim whitespace before comparing","Remember sanitization may make names equal"],"tags":["validation","workflow","rename"],"backgroundTag":"invalid-request-parameters","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}