XX-net/XX-Net · warning
try to delect current version.
Error message
try to delect current version.
What it means
del_version(version) refuses to delete the currently running version directory: it compares against get_current_version_dir() (the dirname containing launcher) and returns False if they match, to avoid deleting the live install.
Source
Thrown at code/default/launcher/update_from_github.py:351
files_in_code_path = os.listdir(code_path)
local_versions = []
for name in files_in_code_path:
if os.path.isdir(os.path.join(code_path, name)):
v = get_folder_version(name)
if v:
local_versions.append([v, name])
local_versions.sort(key=lambda s: list(map(int, s[0].split('.'))), reverse=True)
return local_versions
def get_current_version_dir():
current_dir = os.path.split(root_path)[-1]
return current_dir
def del_version(version):
if version == get_current_version_dir():
xlog.warn("try to delect current version.")
return False
try:
shutil.rmtree(os.path.join(top_path, "code", version))
return True
except Exception as e:
xlog.warn("deleting fail: %s", e)
return False
def update_current_version(version):
start_script = os.path.join(top_path, "code", version, "launcher", "start.py")
if not os.path.isfile(start_script):
xlog.warn("set version %s not exist", version)
return False
current_version_file = os.path.join(top_path, "code", "version.txt")
with open(current_version_file, "w") as fd:View on GitHub (pinned to cfa5bc17b6)
Solutions
- Switch/update to another version first, then delete the old one.
- If the check misfires because the install was moved, fix the directory layout so the running launcher lives under code/<current-version>/.
- Refresh the web UI so the current-version marker is up to date.
Defensive patterns
Strategy: validation
Validate before calling
if version == get_current_version_dir():
raise ValueError('refusing to delete running version %s' % version) Prevention
- Update to a new version before deleting the old one.
- Never bypass the current-version guard.
- Confirm the target dir layout matches code/<version>/.
When it happens
Trigger: Any call to del_version with the version currently active (e.g. web UI cleanup attempting to remove the running build).
Common situations: User selects the running version in the version manager to delete; version.txt and directory naming out of sync after a manual copy of the code tree.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/b85d5d844fa0f23b.
Report an issue: GitHub.