Skip to content

[Bug][Studio/Windows] Missing unsloth.exe console-script launcher makes the repair/update flow hang silently #9758

Closed

Description

@baoyu0

Summary / 问题概述

On Windows, if the console-script launcher unsloth.exe inside the managed venv (~/.unsloth/studio/unsloth_studio/Scripts/unsloth.exe) is missing, the desktop repair/update flow hangs indefinitely. The preflight logs cli_unusable (Managed preflight: cli unusable for ...), the GUI calls start_managed_repair, and the spawned studio update process sits at zero CPU with no network activity and no further log lines — the UI is stuck on "Getting things ready" with no error surfaced to the user. This happened repeatedly (every launch) and only a manual CLI run completed the update.

Windows 上若受管 venv 内的 unsloth.exe 启动器缺失,桌面端 repair/update 流程会无限挂起:preflight 报 cli_unusable 后,GUI 启动的 studio update 进程 0 CPU、无网络活动、日志冻结,界面卡在 "Getting things ready" 且不向用户显示任何错误。多次复现,仅手动 CLI 运行可完成更新。

Root cause / 根因

unsloth.exe is a standard Python console-script (entry point unsloth = unsloth_cli:app, see unsloth-<ver>.dist-info/entry_points.txt). A incomplete/stale install left the .exe missing while python.exe and the unsloth_cli package remained intact. The repair path relies on the launcher existing; when it is absent the parent process never notices the child is wedged.

Fix that worked: re-create the launcher without touching the environment:

unsloth_studio/Scripts/python.exe -m pip install --force-reinstall --no-deps unsloth==2026.8.21
# -> regenerates Scripts/unsloth.exe; afterward preflight reports "cli ready" and updates complete normally

Environment / 环境

  • OS: Windows 11
  • Unsloth Studio desktop app: 0.1.803-beta (winget UnslothAI.Unsloth)
  • Managed venv: ~/.unsloth/studio/unsloth_studio (Python 3.13.15)

Steps to reproduce / 复现步骤

  1. Delete ~/.unsloth/studio/unsloth_studio/Scripts/unsloth.exe (launcher missing while venv otherwise intact).
  2. Launch Unsloth Studio.
  3. Observe: preflight logs cli unusable, repair starts ([update] Starting backend update via ...), then the update process hangs with no CPU / no network / frozen log.

Expected behavior / 期望行为

Either:

  • The repair path should surface a clear error to the user (e.g. "CLI launcher missing — reinstall required") instead of hanging silently, or
  • The repair should re-create the missing console-script launcher itself (it already manages the venv with uv/pip).

Checklist / 检查清单

  • I searched existing issues before opening this report.
  • I removed sensitive information from logs.

Activity

  1. Fizza-Mukhtar commented on Aug 26, 2026

    @Fizza-Mukhtar
    Contributor

    I may be missing something, but I don't think the missing launcher can be the cause.

    Since #8592 the Windows path never executes Scripts\unsloth.exe: resolve_managed_cli_invocation_with in studio/src-tauri/src/process.rs unconditionally runs python.exe -X utf8 -I -c "…from unsloth_cli import app…" instead, because Application Control denies the unsigned generated stub. bin is only a canonical handle — the comment there says "whether or not the file exists" — and the
    a_quarantined_stub_is_still_a_managed_install test covers a venv with python.exe and no launcher. Both the preflight probe and the update go through that same resolver.

    I reproduced your setup on Windows 11 (real venv, unsloth_cli installed, unsloth.exe deleted) and ran the exact command the desktop builds for studio update — it exits 0 with the launcher absent.

    Could you confirm which desktop build you're on relative to that change? #8592 shipped in the pip package at 2026.8.15, but the Rust code ships in the app rather than the package, and I couldn't map 0.1.803-beta back to a commit from the repo. If your app predates it,
    that changes the picture entirely.

    Assuming it doesn't: cli_unusable is that interpreter invocation exiting non-zero, i.e. from unsloth_cli import app failing — a broken package rather than a missing launcher. pip install --force-reinstall --no-deps unsloth==2026.8.21 rewrites the whole package and regenerates the .exe as a side effect, so it would fix that too.

    The hang still seems worth chasing separately. I couldn't find a mechanism for it in the parent — the runtime-launch mutex uses WaitForSingleObject with a 0 timeout so it can't block, and a missing binary or interpreter each produce a clear error — which points at
    the child. If it happens again, could you grab the full log around "[update] Starting backend update via" and the wedged process's command line?

    Get-CimInstance Win32_Process | ? { $_.Name -eq 'python.exe' } | select CommandLine
    
  2. danielhanchen commented on Sep 9, 2026

    @danielhanchen
    Member

    Fixed! The desktop app finds the install through the venv's python.exe and runs the CLI inline, so a missing unsloth.exe launcher no longer wedges the repair or update flow.

    To update: the desktop app updates itself (Settings > General), otherwise unsloth studio update, or in Docker docker exec <container> unsloth-studio-update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions