[GH-ISSUE #4089] [GUI] Deleting a model stops at an empty read-only folder (WinError 5) and leaves the rest of the pack on disk #1782

Open
opened 2026-11-04 01:54:00 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @abdou-rgd on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4089

Area

[GUI] (the desktop app)

Desktop app, Terminal or source?

Desktop app (Windows, Linux or Mac)

What happened

Deleting IQ2_XS from the app showed:

Some files could not be removed: rt: [WinError 5] Accès refusé: 'C:\Users\<user>\Documents\Strata\mtp\rt'; iq2_xs: [WinError 5] Accès refusé: 'C:\Users\<user>\Documents\Strata\packs\iq2_xs\tokenizer'

Both mtp\rt and packs\iq2_xs\tokenizer were empty, with the Windows ReadOnly attribute set. Every folder under Documents\Strata (Models, mtp, packs, Workspace…) has it; I don't know what sets it. Antivirus and Controlled Folder Access are not involved (EnableControlledFolderAccess = 0).

Because shutil.rmtree raises on the first read-only folder, the delete stopped partway. Left on disk: packs\iq2_xs\experts.bin (33.8 GB), dense.bin (1.5 GB) and most of mtp\tensors (~5 GB).

Clearing the attribute then deleting worked straight away.

Where it happens: tools/strata_mcp.py, strata_remove() calls shutil.rmtree(p, onerror=_rmtree_ignore_missing). The hook only ignores FileNotFoundError and re-raises everything else. On Windows, RemoveDirectory refuses a folder with FILE_ATTRIBUTE_READONLY, even when it is empty.

Expected: the delete removes everything it planned, for example with an error hook that clears the read-only attribute and retries (os.chmod(path, stat.S_IWRITE), then func(path)), as pip's rmtree_errorhandler does.

Smallest steps or command that reproduce it

  1. Install a model with the desktop app on Windows (here IQ2_XS, models in Documents\Strata).
  2. Models → delete the model.
  3. The error above appears, and packs\<size> and mtp are still on disk.

Reproduction status

Reproduced locally

Strata version

Strata desktop 0.2.3 · control 0.1.48 (5c8dd32)

Graphics card, memory and system

RTX 3060 12 GB · 32 GB RAM · Windows 11 (26200)

Model, size and settings

Qwen3.8-Flash-Next IQ2_XS (GSQ-RCO)

Originally created by @abdou-rgd on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4089 ### Area [GUI] (the desktop app) ### Desktop app, Terminal or source? Desktop app (Windows, Linux or Mac) ### What happened Deleting IQ2_XS from the app showed: ``` Some files could not be removed: rt: [WinError 5] Accès refusé: 'C:\Users\<user>\Documents\Strata\mtp\rt'; iq2_xs: [WinError 5] Accès refusé: 'C:\Users\<user>\Documents\Strata\packs\iq2_xs\tokenizer' ``` Both `mtp\rt` and `packs\iq2_xs\tokenizer` were **empty**, with the Windows `ReadOnly` attribute set. Every folder under `Documents\Strata` (`Models`, `mtp`, `packs`, `Workspace`…) has it; I don't know what sets it. Antivirus and Controlled Folder Access are not involved (`EnableControlledFolderAccess = 0`). Because `shutil.rmtree` raises on the first read-only folder, the delete stopped partway. Left on disk: `packs\iq2_xs\experts.bin` (33.8 GB), `dense.bin` (1.5 GB) and most of `mtp\tensors` (~5 GB). Clearing the attribute then deleting worked straight away. **Where it happens:** `tools/strata_mcp.py`, `strata_remove()` calls `shutil.rmtree(p, onerror=_rmtree_ignore_missing)`. The hook only ignores `FileNotFoundError` and re-raises everything else. On Windows, `RemoveDirectory` refuses a folder with `FILE_ATTRIBUTE_READONLY`, even when it is empty. **Expected:** the delete removes everything it planned, for example with an error hook that clears the read-only attribute and retries (`os.chmod(path, stat.S_IWRITE)`, then `func(path)`), as pip's `rmtree_errorhandler` does. ### Smallest steps or command that reproduce it 1. Install a model with the desktop app on Windows (here IQ2_XS, models in `Documents\Strata`). 2. Models → delete the model. 3. The error above appears, and `packs\<size>` and `mtp` are still on disk. ### Reproduction status Reproduced locally ### Strata version Strata desktop 0.2.3 · control 0.1.48 (5c8dd32) ### Graphics card, memory and system RTX 3060 12 GB · 32 GB RAM · Windows 11 (26200) ### Model, size and settings Qwen3.8-Flash-Next IQ2_XS (GSQ-RCO)
Author
Owner

@XiaoBinGan commented on GitHub (Nov 1, 2026):

Reproduced on main (c62d5e3a) on Windows 11 with the delete path of tools/strata_mcp.py (strata_remove()), no
model files and no GPU needed.

strata_remove() calls shutil.rmtree(p, onerror=_rmtree_ignore_missing), and the hook only returns for
FileNotFoundError, re-raising everything else. Windows refuses RemoveDirectory on a folder with
FILE_ATTRIBUTE_READONLY even when it is empty, so the first such folder stops that model's delete part-way:

empty read-only folder:
  failed=["rt: [WinError 5] 拒绝访问。: '<tmp>\\mtp\\rt'"]  folder_still_there=True
read-only folder with a read-only file inside:
  failed=["tokenizer: [WinError 5] 拒绝访问。: '<tmp>\\...\\tokenizer.json'"]  folder_still_there=True

(The message text is in Chinese because of this machine's locale; the code is WinError 5, ERROR_ACCESS_DENIED.)

Expected: the delete removes every path it planned (clear the read-only attribute and retry that one path, as pip's
rmtree_errorhandler does), so a read-only empty folder costs only itself and not the rest of the pack.

I will send a PR with the hook change and a Windows-only regression test in tools/test_strata_mcp.py that fails on
main with exactly that failed=[...] and passes with the change.

<!-- gh-comment-id:6556927869 --> @XiaoBinGan commented on GitHub (Nov 1, 2026): Reproduced on `main` (c62d5e3a) on Windows 11 with the delete path of `tools/strata_mcp.py` (`strata_remove()`), no model files and no GPU needed. `strata_remove()` calls `shutil.rmtree(p, onerror=_rmtree_ignore_missing)`, and the hook only returns for `FileNotFoundError`, re-raising everything else. Windows refuses `RemoveDirectory` on a folder with `FILE_ATTRIBUTE_READONLY` even when it is empty, so the first such folder stops that model's delete part-way: ```text empty read-only folder: failed=["rt: [WinError 5] 拒绝访问。: '<tmp>\\mtp\\rt'"] folder_still_there=True read-only folder with a read-only file inside: failed=["tokenizer: [WinError 5] 拒绝访问。: '<tmp>\\...\\tokenizer.json'"] folder_still_there=True ``` (The message text is in Chinese because of this machine's locale; the code is WinError 5, `ERROR_ACCESS_DENIED`.) Expected: the delete removes every path it planned (clear the read-only attribute and retry that one path, as pip's `rmtree_errorhandler` does), so a read-only empty folder costs only itself and not the rest of the pack. I will send a PR with the hook change and a Windows-only regression test in `tools/test_strata_mcp.py` that fails on `main` with exactly that `failed=[...]` and passes with the change.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1782
No description provided.