XX-net/XX-Net · warning
remove %s fail:%r
Error message
remove %s fail:%r
What it means
In the win10 IPv6 tunnel elevation path, before running the helper script with admin rights (win32runas.runas) the code tries to clear an old log file; os.remove(log_file) raised and the warning was logged. Elevation then proceeds, so this is non-fatal.
Source
Thrown at code/default/gae_proxy/local/ipv6_tunnel/win10.py:169
netsh interface teredo set state disable
netsh interface 6to4 set state disabled
netsh interface isatap set state disabled
"""
has_admin = win32runas.is_admin()
# Use this if need admin
# Don't hide the console window
def elevate(script_path, clear_log=True):
global script_is_running
if not script_is_running:
script_is_running = True
if clear_log and os.path.isfile(log_file):
try:
os.remove(log_file)
except Exception as e:
xlog.warn("remove %s fail:%r", log_file, e)
try:
win32runas.runas(None, script_path)
return True
except Exception as e:
xlog.warning('elevate e:%r', e)
finally:
script_is_running = False
script_is_running = False
last_get_state_time = 0
last_set_server_time = 0
last_state = "unknown"
client_ext = 'natawareclient' if platform.version()[0] > '6' else 'enterpriseclient'
def client_type():
try:View on GitHub (pinned to cfa5bc17b6)
Solutions
- Kill any lingering IPv6 helper/script process (check Task Manager for the elevation script) and retry
- Delete the log file manually from an elevated shell, then retry the operation
- Ensure the proxy's log directory is writable/deletable by the invoking user
- Ignore if the subsequent runas succeeds and the tunnel comes up
Defensive patterns
Strategy: try-catch
Validate before calling
import os
if os.path.exists(log_file):
try:
os.rename(log_file, log_file + '.old') # rename often succeeds where remove fails
except OSError:
pass Try / catch
try:
ok = elevate(clear_log=True)
except Exception as e:
xlog.warning('elevate e:%r', e)
ok = False
if not ok:
prompt_user_to_run_helper_manually() Prevention
- Terminate lingering elevation helper processes before retrying
- Keep the log directory ACLs writable by the invoking user
- Prefer renaming stale logs to deleting on Windows
When it happens
Trigger: elevate(clear_log=True) sees log_file exists; os.remove fails because the file is locked by a running elevated helper, open in another handle, or ACLs deny deletion (typical on Windows under UAC).
Common situations: Previous enable/disable/set_best_server helper still running or crashed holding the log; script run from a non-admin account without delete rights on the file; antivirus scanning the file at removal time.
Related errors
- remove %s fail:%r
- Servers could not be resolved, %r.
- parse reserve port fail, line:%s, e:%r
- Can't found acceptable ports
- proxy_setting:%r
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/9e63293f59614e26.
Report an issue: GitHub.