Repository navigation
Description
Version: graphifyy 0.8.49, Windows 11, Git for Windows
Symptom
Every commit and checkout prints:
[graphify hook] could not locate a Python with graphify installed. Add the graphify bin dir to
PATH or re-run 'graphify hook install' from the env where graphify lives.
graphify hook install does not fix it — the regenerated hook has the same defect, and
graphify update . from the same shell works fine.
Cause
graphify-out/.graphify_python correctly contains C:\Program Files\Python313\python.exe, but
all four probes in the generated hook fail on it:
-
_PINNEDis emitted as_PINNED=''byhook install— never populated, so the probe
documented as "tried first so the hook works even when the graphify launcher is not on PATH"
is dead. -
.graphify_pythonis read with_FROM_FILE=$(cat "$_GFY_PYTHON_FILE" 2>/dev/null | tr -d '[:space:]')tr -d '[:space:]'deletes interior whitespace, so the path becomes
C:\ProgramFiles\Python313\python.exe— which does not exist. It should trim leading and
trailing whitespace only. The file is also written with a UTF-8 BOM, which survives thetr
and corrupts the first path character.Even with that fixed, the allowlist immediately after rejects the value: the character class
*[!a-zA-Z0-9/_.@:\-]*excludes both the backslash and the space, so no native Windows path
can pass it. -
Shebang probe —
command -v graphifyreturnsgraphify.exe, and the hook explicitly sets
_SHEBANG=""for*.exe, so this yields nothing on Windows by design. -
python/python3fallback — resolves to whatever is first on PATH, commonly a project
venv or the WindowsApps stub, neither of which has graphify importable.
Reproduce the second probe directly:
$ _F=$(cat graphify-out/.graphify_python | tr -d '[:space:]'); echo "[$_F]"
[C:\ProgramFiles\Python313\python.exe] # note the lost space
$ case "$_F" in *[!a-zA-Z0-9/_.@:\-]*) echo REJECTED ;; esac
REJECTEDSuggested fixes
- Trim only leading/trailing whitespace when reading
.graphify_python, and strip a BOM. - Write
.graphify_pythonwithout a BOM. - Populate
_PINNEDathook installtime withsys.executable— this is the one probe that
works regardless of PATH, and it is already quoted in the hook, so spaces are harmless. - Widen or drop the allowlist for paths that come from the pin/pointer file rather than from a
parsed shebang. A backslash and a space are ordinary characters in a Windows path.
Workaround
Setting _PINNED='/c/Program Files/Python313/python.exe' by hand in .git/hooks/post-commit and
.git/hooks/post-checkout makes both hooks work immediately — the pin probe quotes the value, so
the space is fine. It is lost on the next hook install.
Activity
sde-melo commentedon Aug 18, 2026
Same failure on graphifyy 0.9.46 (Windows 11, Git for Windows,
uv tool install "graphifyy[terraform]"), with one more angle: the home directory contains non-ASCII characters as well as spaces (C:\Users\Sébastien de Melo\...), so the.graphify_pythonallowlist*[!a-zA-Z0-9/_.@:\-]*rejects the interpreter path twice over — and, as #2852 describes, thecommand -v graphifyprobe cannot help because the uv shim in~/.local/binhas nopython.exebeside it and no parsable shebang. Result: every commit printscould not locate a Python with graphify installed, even right aftergraphify hook installrun from the tool's own environment (_PINNED=''is emitted empty here too).Workaround that works, for anyone stuck on this: create an ASCII-only junction to uv's tool directory and point the pin file at it —
(forward slashes, no BOM, no trailing whitespace; the file is machine-specific so it belongs in
.gitignore). After that the post-commit hook launches the background rebuild normally.Suggested fixes, in order of bang for the buck: (1) let an environment variable (
GRAPHIFY_PYTHON) or the pinned_PINNEDvalue bypass the allowlist entirely — the allowlist is meant to stop injection, and a-xcheck on the resolved path already does that job; (2) trim only leading/trailing whitespace instead oftr -d '[:space:]'; (3) accept spaces, backslashes and non-ASCII letters in the allowlist (Windows user profiles are routinelyFirstname Lastnamewith accents).