XX-net/XX-Net · warning

deleting fail: %s

Error message

deleting fail: %s

What it means

shutil.rmtree of code/<version> raised (the non-current version path); logged with the exception and del_version returns False so the UI shows deletion failed.

Source

Thrown at code/default/launcher/update_from_github.py:358

    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:
        fd.write(version)
    return True


def restart_xxnet(version=None):
    import module_init
    module_init.stop_all()

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Stop all XX-Net processes before deleting old versions.
  2. Fix ownership/permissions: chmod -R or run the delete with adequate privileges.
  3. Delete the directory manually (rm -rf code/<version>) and refresh the UI.
Defensive patterns

Strategy: try-catch

Validate before calling

import os, stat
d = os.path.join(top_path, 'code', version)
if not os.path.isdir(d): raise FileNotFoundError(d)
if not os.access(d, os.W_OK): raise PermissionError(d)

Try / catch

try:
    ok = del_version(version)
except OSError as e:
    log.warn('delete failed, will retry after restart: %r', e)

Prevention

When it happens

Trigger: Permission denied on files inside the old version dir, files locked by a still-running module, or the directory not existing / path mismatch on case-sensitive filesystems.

Common situations: Leftover process from the old version holding files; install dir owned by root after running with sudo; Windows file locks.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/ebdb21b9b37d785b. Report an issue: GitHub.