{"record":{"id":"091110ec1e5d4ccd","repo":"XX-net/XX-Net","slug":"enable-auto-start-create-path-s-fail-r","errorCode":null,"errorMessage":"Enable auto start, create path:%s fail:%r","messagePattern":"Enable auto start, create path:(.+?) fail:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/launcher/autorun.py","lineNumber":76,"sourceCode":"    home_config_path = os.path.expanduser(_xdg_config_home)\n    _xdg_user_autostart = os.path.join(home_config_path, \"autostart\")\n\n\n    def getfilename(name):\n        \"\"\"get the filename of an autostart (.desktop) file\"\"\"\n        return os.path.join(_xdg_user_autostart, name + \".desktop\")\n\n\n    def add(name, application):\n        if not os.path.isdir(home_config_path):\n            xlog.warn(\"autorun linux config path not found:%s\", home_config_path)\n            return\n\n        if not os.path.isdir(_xdg_user_autostart):\n            try:\n                os.mkdir(_xdg_user_autostart)\n            except Exception as e:\n                xlog.warn(\"Enable auto start, create path:%s fail:%r\", _xdg_user_autostart, e)\n                return\n\n        \"\"\"add a new autostart entry\"\"\"\n        desktop_entry = \"[Desktop Entry]\\n\" \\\n                        \"Name=%s\\n\" \\\n                        \"Exec=%s\\n\" \\\n                        \"Type=Application\\n\" \\\n                        \"Terminal=false\\n\" \\\n                        \"X-GNOME-Autostart-enabled=true\" % (name, application)\n        with open(getfilename(name), \"w\") as f:\n            f.write(desktop_entry)\n\n\n    def exists(name):\n        \"\"\"check if an autostart entry exists\"\"\"\n        return os.path.exists(getfilename(name))\n\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/autorun.py#L58-L94","documentation":"The launcher's autostart add() failed to create the XDG autostart directory (~/.config/autostart) before writing a .desktop entry. os.mkdir raised (typically because a parent is missing or permissions are wrong), so the launcher logged a warning and gave up on enabling auto-start.","triggerScenarios":"Calling add() on Linux when ~/.config/autostart does not exist and os.mkdir fails, e.g. missing ~/.config parent, read-only $HOME, or a file occupying the path.","commonSituations":"Running XX-Net as a restricted user, from a container/live session with a read-only home, or with a broken XDG_CONFIG_HOME environment variable.","solutions":["Verify $HOME and ~/.config exist and are writable: mkdir -p ~/.config/autostart","Check XDG_CONFIG_HOME if set — ensure it points to a valid writable directory","Remove any regular file at the autostart path (os.mkdir fails if a file exists there)","Run the launcher with sufficient filesystem permissions"],"exampleFix":"// before\nif not os.path.isdir(_xdg_user_autostart):\n    try:\n        os.mkdir(_xdg_user_autostart)\n    except Exception as e:\n        xlog.warn(\"Enable auto start, create path:%s fail:%r\", _xdg_user_autostart, e)\n        return\n// after\ntry:\n    os.makedirs(_xdg_user_autostart, exist_ok=True)\nexcept Exception as e:\n    xlog.warn(\"Enable auto start, create path:%s fail:%r\", _xdg_user_autostart, e)\n    return","handlingStrategy":"validation","validationCode":"import os\nautostart_dir = os.path.expanduser('~/.config/autostart')\nparent_ok = os.access(os.path.dirname(autostart_dir) or '/', os.W_OK)\nif not parent_ok:\n    # skip auto-start enable or prompt user","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create ~/.config/autostart in deployment scripts","Use os.makedirs(path, exist_ok=True) instead of os.mkdir","Respect XDG_CONFIG_HOME when computing the autostart directory"],"tags":["linux","xdg-autostart","filesystem","mkdir","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}