{"record":{"id":"9e63293f59614e26","repo":"XX-net/XX-Net","slug":"remove-s-fail-r-9e6329","errorCode":null,"errorMessage":"remove %s fail:%r","messagePattern":"remove (.+?) fail:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/gae_proxy/local/ipv6_tunnel/win10.py","lineNumber":169,"sourceCode":"netsh interface teredo set state disable\nnetsh interface 6to4 set state disabled\nnetsh interface isatap set state disabled\n\"\"\"\n\nhas_admin = win32runas.is_admin()\n\n# Use this if need admin\n# Don't hide the console window\ndef elevate(script_path, clear_log=True):\n    global script_is_running\n    if not script_is_running:\n        script_is_running = True\n\n        if clear_log and os.path.isfile(log_file):\n            try:\n                os.remove(log_file)\n            except Exception as e:\n                xlog.warn(\"remove %s fail:%r\", log_file, e)\n\n        try:\n            win32runas.runas(None, script_path)\n            return True\n        except Exception as e:\n            xlog.warning('elevate e:%r', e)\n        finally:\n            script_is_running = False\n\nscript_is_running = False\nlast_get_state_time = 0\nlast_set_server_time = 0\nlast_state = \"unknown\"\n\nclient_ext = 'natawareclient' if platform.version()[0] > '6' else 'enterpriseclient'\n\ndef client_type():\n    try:","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/gae_proxy/local/ipv6_tunnel/win10.py#L151-L187","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os\nif os.path.exists(log_file):\n    try:\n        os.rename(log_file, log_file + '.old')  # rename often succeeds where remove fails\n    except OSError:\n        pass","typeGuard":null,"tryCatchPattern":"try:\n    ok = elevate(clear_log=True)\nexcept Exception as e:\n    xlog.warning('elevate e:%r', e)\n    ok = False\nif not ok:\n    prompt_user_to_run_helper_manually()","preventionTips":["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"],"tags":["ipv6","windows","uac-elevation","file-io"],"backgroundTag":"file-delete-permission-denied","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}