Graphify-Labs/graphify · error · RuntimeError
git hooks path from {source} looks like a Windows path: {val
Error message
git hooks path from {source} looks like a Windows path: {value!r}. On WSL/POSIX this can't resolve to a real directory. Unset it with `git config --local --unset core.hooksPath`, or set a POSIX path. What it means
Raised by _reject_windows_path during hook install when core.hooksPath (from git config or equivalent source) contains a Windows-style path — a drive-letter prefix (C:\...) or any backslash — on a POSIX system. The docstring explains the trap: Path('C:\\Users\\...').is_absolute() is False on Linux, so git would silently create a junk directory with literal backslashes inside the repo and report success while the real .git/hooks gets nothing; graphify fails loudly instead (regression guard #1385).
Source
Thrown at graphify/hooks.py:408
return parent
return None
_WINDOWS_DRIVE_RE = re.compile(r"^[A-Za-z]:[\\/]")
def _reject_windows_path(value: str, source: str) -> None:
"""Raise if a hooks path looks like a Windows absolute path (#1385).
On POSIX/WSL ``Path("C:\\Users\\...").is_absolute()`` is False, so an absolute
Windows hooks path gets joined under the repo root and mkdir'd as a literal
junk directory (backslashes and all), while install reports success and the
real ``.git/hooks`` gets nothing. Fail loudly instead so the user can fix it.
"""
if os.name == "nt":
return
if _WINDOWS_DRIVE_RE.match(value) or "\\" in value:
raise RuntimeError(
f"git hooks path from {source} looks like a Windows path: {value!r}. "
f"On WSL/POSIX this can't resolve to a real directory. Unset it with "
f"`git config --local --unset core.hooksPath`, or set a POSIX path."
)
def _hooks_dir(root: Path) -> Path:
"""Return the git hooks directory, respecting core.hooksPath if set (e.g. Husky).
Asks git itself via ``rev-parse --git-path hooks`` rather than parsing
``.git/config`` with configparser: git legally allows duplicate keys and
sections (VS Code writes such configs), which a strict configparser rejects
with DuplicateOptionError/DuplicateSectionError, so every hook command
printed a spurious "could not read core.hooksPath" warning (#1907). git
resolves core.hooksPath, includeIf, and linked worktrees (where .git is a
file, not a directory) correctly in one place. Genuinely corrupt configs
are still surfaced: git itself fails on them, and its stderr is printed.
"""View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Unset the stale value: `git config --local --unset core.hooksPath` (use --global if it lives there)
- Or set a POSIX path: `git config core.hooksPath .husky`
- On WSL, verify with `git config --show-origin core.hooksPath` which file supplies the Windows path and fix that file
- Re-run `graphify hooks install` afterwards
Example fix
# before git config core.hooksPath # C:\Users\me\repo\.husky graphify hooks install # RuntimeError: looks like a Windows path # after git config --local --unset core.hooksPath graphify hooks install
Defensive patterns
Strategy: validation
Validate before calling
import re, subprocess
WINDOWS_DRIVE = re.compile(r"^[A-Za-z]:[\\/]")
raw = subprocess.run(
["git", "config", "--get", "core.hooksPath"], capture_output=True, text=True
).stdout.strip()
if raw and (WINDOWS_DRIVE.match(raw) or "\\" in raw):
raise SystemExit(
f"core.hooksPath {raw!r} is a Windows path on POSIX - "
"fix with: git config --local --unset core.hooksPath"
) Try / catch
try:
install(Path("."))
except RuntimeError as e:
if "looks like a Windows path" in str(e):
subprocess.check_call(["git", "config", "--local", "--unset", "core.hooksPath"])
install(Path("."))
else:
raise Prevention
- On WSL, check `git config --show-origin core.hooksPath` for Windows-sourced values after cloning
- Never copy .git/config between Windows and POSIX machines
- Use repo-relative POSIX hooksPath values (e.g. .husky) so they port across OSes
When it happens
Trigger: Running `graphify hooks install` (or any path that resolves _hooks_dir) on Linux/WSL where core.hooksPath was copied from a Windows setup — e.g. a repo config shared from a Windows teammate, a dotfiles sync, or a WSL clone of a repo configured by Windows-side tooling (Husky etc.).
Common situations: Mixed Windows/WSL teams where .git/config or a global git config carries Windows paths; copying a repo including .git from Windows; CI on Linux after committing a Windows-local hooksPath.
Related errors
- No git repository found at or above {path.resolve()}
- Graph has {G.number_of_nodes()} nodes - too large for HTML v
- No LLM backend configured. Set one of: GEMINI_API_KEY, ANTHR
- Unknown backend {backend!r}. Available: {sorted(BACKENDS)}
- No API key for backend '{backend}'. Set {_format_backend_env
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/8188a11b196e9cae.
Report an issue: GitHub.