Skip to content

[Bug] Windows: Access denied on llama-server.exe when Studio is run without admin after elevated install #4846

@ZeroGold

Description

@ZeroGold

Title: [Bug] Windows: Access denied on llama-server.exe when Studio is run without admin after elevated install


Did you update?
pip install --upgrade unsloth unsloth_zoo — yes, running latest.

Colab or Kaggle or local / cloud
Local — Windows 11, NVIDIA RTX GPU

Which Unsloth version, TRL version, transformers version, PyTorch version?
Unsloth Studio v0.1.2-beta, Python 3.13


Bug

When unsloth studio setup is run from an elevated (Administrator) terminal, the built llama-server.exe inherits restrictive ACLs. If the user then launches Unsloth Studio without admin privileges (which is the normal case), model validation fails with [WinError 5] Access is denied.

Models load fine in LM Studio using the same GGUF files, confirming the models themselves are valid.

Reproduction

  1. Open PowerShell as Administrator
  2. Run unsloth studio setup (installs and builds llama-server.exe under ~/.unsloth/llama.cpp/)
  3. Close the admin terminal
  4. Open a normal (non-elevated) terminal
  5. Run unsloth studio
  6. Try to load any GGUF model (e.g. unsloth/Qwen3.5-4B-GGUF)
  7. Model validation fails with Access is denied

Logs

{"timestamp": "2026-04-04T07:37:52.818254Z", "level": "error", "event": "Error validating model identifier 'unsloth/Qwen3.5-4B-GGUF': [WinError 5] Access is denied: 'C:\\\\Users\\\\[REDACTED]\\\\.unsloth\\\\llama.cpp\\\\build\\\\bin\\\\Release\\\\llama-server.exe'", "exc_info": true}
{"timestamp": "2026-04-04T07:37:52.818697Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/inference/validate", "status_code": 400, "process_time_ms": 69.05}

Temporary workaround

Run Unsloth Studio as Administrator (right-click → Run as administrator). This works but shouldn't be required for normal use.

Suggested fix

The setup script should ensure llama-server.exe (and other built binaries) are accessible to the installing user's normal (non-elevated) account. Potential approaches:

  1. Post-build permission fix: After building llama-server.exe, run icacls to grant BUILTIN\Users read+execute access, so it works regardless of elevation context
  2. Detect elevated install: Warn the user during setup that installing as admin may cause permission issues, and offer to fix ACLs automatically
  3. Startup detection: If Studio detects [WinError 5] at runtime, check whether admin privilege mismatch is the cause and surface an actionable error message instead of a generic "Invalid model" 400
  4. Elevate on startup (not recommended): As a last resort, Studio could request admin privileges on launch via UAC. This would work but adds unnecessary friction and violates least-privilege principles — the real fix should ensure the binary is accessible without elevation.

I've already prototyped option 3 (runtime detection with ctypes.windll.shell32.IsUserAnAdmin() + retry-with-backoff for transient file locks). If this isn't addressed in a couple weeks, I'm happy to put together a PR covering both the install-time fix and the runtime fallback.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions