Repository navigation
Description
Environment
- OS: Windows 11 Pro
- Shell: Windows PowerShell 5.1 (the shell the skill's own code blocks are written for)
- graphify: 0.9.49 (CLI via
pip install graphifyy, skill installed viagraphify install) - Python: 3.14, plain
pip-into-active-env install (not uv/pipx)
What happened
After running the full /graphify . pipeline once, I ran graphify hook install (post-commit + post-checkout) so the graph would auto-rebuild after future commits, per references/hooks.md.
The next git commit correctly triggered the hook ([graphify hook] launching background rebuild (log: ~/.cache/graphify-rebuild.log)), but the rebuild silently failed every time:
[graphify hook] 3 file(s) changed - rebuilding graph...
[graphify hook] Rebuild failed: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '\ufeffC:\Users\<user>\...\graphify-out'
Note the \ufeff (UTF-8 BOM) prepended to the path — that's what WinError 123 is complaining about.
Root cause
SKILL.md Step 1 (the block every fresh /graphify <path> run executes) writes the two sidecar files the hook later reads:
$GRAPHIFY_PYTHON | Out-File -FilePath graphify-out\.graphify_python -Encoding utf8 -NoNewline
(Resolve-Path INPUT_PATH).Path | Out-File -FilePath graphify-out\.graphify_root -Encoding utf8 -NoNewline(SKILL.md lines 120 and 122 in 0.9.49.)
Out-File -Encoding utf8 in Windows PowerShell 5.1 always emits a UTF-8 BOM (EF BB BF) — there is no BOM-less utf8 codepage on 5.1 (that only exists as utf8NoBOM starting in PowerShell 6+). -NoNewline suppresses the trailing newline but does nothing about the BOM.
So graphify-out/.graphify_python and graphify-out/.graphify_root end up as e.g. b'\xef\xbb\xbfC:\Python314\python.exe' instead of b'C:\Python314\python.exe'.
Whatever code path the hook uses to read .graphify_root (and hand it to Python's path/subprocess machinery) doesn't strip the BOM, so the leading \ufeff character rides along into a Windows path API and blows up with WinError 123.
This is nasty because it's silent from the user's perspective in the normal flow: graphify hook install reports success, hook status reports "installed", the hook visibly fires on every commit — but the rebuild itself fails every single time, so the graph silently goes stale forever unless someone thinks to check ~/.cache/graphify-rebuild.log. Anyone on plain Windows PowerShell 5.1 (i.e. anyone who didn't proactively install PowerShell 7) who follows the skill's own documented bootstrap hits this on the very first commit after hook install.
Fix I applied locally (works)
Rewrite both sidecar files without a BOM:
$pythonPath = (Get-Content graphify-out\.graphify_python -Raw).Trim()
$rootPath = (Get-Content graphify-out\.graphify_root -Raw).Trim()
[System.IO.File]::WriteAllText("graphify-out\.graphify_python", $pythonPath, [System.Text.UTF8Encoding]::new($false))
[System.IO.File]::WriteAllText("graphify-out\.graphify_root", $rootPath, [System.Text.UTF8Encoding]::new($false))After that, graphify update . and the post-commit hook both rebuild cleanly.
Suggested upstream fix
Two independent, non-exclusive fixes — either alone closes this:
- Write without a BOM in the first place. In SKILL.md Step 1 (and anywhere else in the skill/CLI that writes
.graphify_python/.graphify_rootvia PowerShell), swapOut-File -Encoding utf8for either-Encoding utf8NoBOM(PS7+) with a version-gated fallback to[System.IO.File]::WriteAllText(path, content, [System.Text.UTF8Encoding]::new($false))on 5.1, or just always use the[System.IO.File]::WriteAllTextform directly — it's BOM-less on every PowerShell version and sidesteps the whole-Encodingfootgun. - Defense in depth on read. Wherever the Python side reads these two sidecar files (hook rebuild path resolution,
graphify update's interpreter/root detection, etc.),.lstrip('\ufeff')the contents before using them as a path/interpreter string. Costs nothing and guards against any other BOM-writing code path (existing files from other editors, future regressions) that hits the same failure mode.
Happy to open a PR for #1 if useful — the fix is small and I already have it working locally.
Activity
rohit-jsfreaky commentedon Aug 25, 2026
Confirmed on Windows PowerShell 5.1.26100.9168. Ran both forms against the same interpreter path and diffed the bytes:
Out-File -Encoding utf8 -NoNewlinewritesEF BB BFahead of it (26 bytes), whileWriteAllTextwithNew-Object System.Text.UTF8Encoding $falsewrites 23 — no BOM, and still no trailing newline. The POSIX fragment already writes those same bytes withecho >.The read side is worth fixing too. All five readers (
hooks.py×2,watch.py,reflect.py,build.py) decode withutf-8, which keeps the BOM as U+FEFF, andstr.strip()does not remove it —''.isspace()is False. Rewriting the markers alone only helps fresh runs; decoding withutf-8-sigalso repairs installs already in this state on their next commit, and is a no-op on a clean file.There is a quieter failure than WinError 123, too. In
_infer_merge_rootthe BOM makes the recorded path stop being drive-qualified, soPath(recorded).resolve()treats it as relative and silently joins it onto the cwd — a wrong scan root with no error at all.Opening a PR that does both sides.
fix(windows): stop a PowerShell BOM breaking hook rebuilds (#3028)
fix(windows): read .graphify_root BOM-tolerantly in the update-recove…
chore: bump to 0.9.50
safishamsi commentedon Aug 25, 2026
Fixed in v0.9.50: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.50. Closing as resolved.