{"record":{"id":"c58e0712ab33c5cb","repo":"OpenBMB/ChatDev","slug":"failed-to-update-workflow-id-after-rename","errorCode":null,"errorMessage":"Failed to update workflow id after rename","messagePattern":"Failed to update workflow id after rename","errorType":"exception","errorClass":"WorkflowExecutionError","httpStatus":null,"severity":"error","filePath":"server/services/workflow_storage.py","lineNumber":153,"sourceCode":"    logger = get_server_logger()\n    try:\n        source_path.rename(target_path)\n    except Exception as exc:\n        logger.log_exception(exc, f\"Failed to rename workflow file {source_safe} to {target_safe}\")\n        raise WorkflowExecutionError(\n            \"Failed to rename workflow file\",\n            details={\"source\": source_safe, \"target\": target_safe},\n        )\n\n    try:\n        new_workflow_id = Path(target_safe).stem\n        content = target_path.read_text(encoding=\"utf-8\")\n        updated = _update_workflow_id(content, new_workflow_id)\n        if updated != content:\n            target_path.write_text(updated, encoding=\"utf-8\")\n    except Exception as exc:\n        logger.log_exception(exc, f\"Failed to update workflow id after rename to {target_safe}\")\n        raise WorkflowExecutionError(\n            \"Failed to update workflow id after rename\",\n            details={\"target\": target_safe},\n        )\n\n    logger.info(\n        \"Workflow file renamed\",\n        log_type=LogType.WORKFLOW,\n        source=source_safe,\n        target=target_safe,\n        action=\"rename\",\n    )\n\n\ndef copy_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:","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/services/workflow_storage.py#L135-L171","documentation":"After a successful file rename, rename_workflow reads the target file and rewrites the workflow's internal id (_update_workflow_id) to match the new filename stem. Any failure reading/writing the file in this post-rename step raises WorkflowExecutionError. Note the file rename itself already succeeded.","triggerScenarios":"File becomes unreadable/unwritable immediately after rename (permissions changed, disk full, file deleted by a concurrent process), or read_text fails due to encoding issues.","commonSituations":"Disk fills exactly between rename and rewrite; antivirus/locking on Windows; concurrent delete racing the id update.","solutions":["Check logs for the underlying exception","Verify the file still exists and is writable; re-run the rename from the new filename (or manually fix the id field)","Free disk space / fix permissions, then retry the id update manually"],"exampleFix":"# before (assume success)\nrename_workflow_file(sid, src, tgt)\n# after\nrename_workflow_file(sid, src, tgt)\n# note: on this error the file IS renamed; only the id field inside may be stale\n# fix by editing id: <new-stem> in the target yaml","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    rename_workflow_file(sid, src, tgt)\nexcept WorkflowExecutionError as e:\n    if 'update workflow id' in str(e):\n        manually_set_id_field(tgt, Path(tgt).stem)  # file already renamed","preventionTips":["Know the file rename succeeded when this fires — repair, don't re-rename","Keep directory writable throughout multi-step ops","Monitor disk space"],"tags":["workflow","rename","io","post-operation"],"backgroundTag":"post-rename-update-failed","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}