[GH-ISSUE #2073] Windows first-run custom path setup can hang on missing drive roots #1264

Closed
opened 2026-10-29 14:50:41 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @VectorPeak on GitHub (Jul 6, 2026).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/2073

## Bug

During first-run interactive setup, kt asks users to choose or enter a model storage path. When a custom path does not already exist, _prompt_custom_path() walks upward until it finds an existing parent directory and then checks whether that parent is writable.

The current loop only treats / as the filesystem root:

parent = str(Path(custom_path).parent)
while not os.path.exists(parent) and parent != "/":
    parent = str(Path(parent).parent)

That works for POSIX-style paths, but it can hang on Windows roots. For example, if a user enters a path on a missing drive such as Z:\models, Path("Z:\\").parent remains Z:\. The loop keeps assigning the same parent value while parent != "/" remains true.

Impact

The first-run setup can appear frozen before saving or rejecting the custom model path. This is realistic when a user enters a disconnected external drive, unavailable network drive, or mistyped Windows drive letter.

Reproduction

from pathlib import Path
import os

parent = r"Z:\models"
trace = []

for _ in range(8):
    trace.append(parent)
    if os.path.exists(parent) or parent == "/":
        break
    parent = str(Path(parent).parent)

print(trace)
print(len(trace) >= 2 and trace[-1] == trace[-2])

Observed on Windows:

['Z:\\models', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\']
True

Expected behavior

The parent-directory walk should stop once it reaches a filesystem root or any parent path that no longer changes, then reject the unwritable path and prompt again instead of looping forever.

Originally created by @VectorPeak on GitHub (Jul 6, 2026). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/2073 ## Bug During first-run interactive setup, `kt` asks users to choose or enter a model storage path. When a custom path does not already exist, `_prompt_custom_path()` walks upward until it finds an existing parent directory and then checks whether that parent is writable. The current loop only treats `/` as the filesystem root: ```python parent = str(Path(custom_path).parent) while not os.path.exists(parent) and parent != "/": parent = str(Path(parent).parent) ``` That works for POSIX-style paths, but it can hang on Windows roots. For example, if a user enters a path on a missing drive such as `Z:\models`, `Path("Z:\\").parent` remains `Z:\`. The loop keeps assigning the same parent value while `parent != "/"` remains true. ## Impact The first-run setup can appear frozen before saving or rejecting the custom model path. This is realistic when a user enters a disconnected external drive, unavailable network drive, or mistyped Windows drive letter. ## Reproduction ```python from pathlib import Path import os parent = r"Z:\models" trace = [] for _ in range(8): trace.append(parent) if os.path.exists(parent) or parent == "/": break parent = str(Path(parent).parent) print(trace) print(len(trace) >= 2 and trace[-1] == trace[-2]) ``` Observed on Windows: ```text ['Z:\\models', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\', 'Z:\\'] True ``` ## Expected behavior The parent-directory walk should stop once it reaches a filesystem root or any parent path that no longer changes, then reject the unwritable path and prompt again instead of looping forever.
Author
Owner

@yyj6666667 commented on GitHub (Jul 6, 2026):

The windows path is not usable on ktransformers till now. Thanks for the pointing out anyway.

<!-- gh-comment-id:4891746537 --> @yyj6666667 commented on GitHub (Jul 6, 2026): The windows path is not usable on ktransformers till now. Thanks for the pointing out anyway.
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
kvcache-ai/ktransformers#1264
No description provided.