Skip to content

claude-cli community labeling silently fails on Windows (WinError 2) — _call_llm uses bare "claude" while _call_claude_cli resolves claude.cmd #1288

Closed

Description

@DawEdisto

Summary

graphify label --backend=claude-cli (and any _call_llm text path) silently falls back to Community N placeholders on Windows. The community-naming call dies with [WinError 2] The system cannot find the file specified, which generate_community_labels swallows into placeholder degradation, so the run reports success with no real labels.

Environment

  • graphify 0.8.35
  • Windows 11, Python 3.12.10
  • Claude Code CLI installed via npm (claude.cmd on PATH, no claude.exe)

Root cause

Two functions shell out to the CLI, and only one has the Windows fix:

  • ✅ _call_claude_cli (extraction) — llm.py ~L853–896 — explicitly resolves claude.cmd via shutil.which("claude.cmd") and invokes the full path. There is even a comment documenting this exact trap.
  • ❌ _call_llm (generic text path, used by label_communities) — llm.py L1572–1575 — guards with shutil.which("claude") but then runs the bare subprocess.run(["claude", "-p", "--output-format", "json", "--no-session-persistence"], ...).

On Windows, shutil.which("claude") honors PATHEXT and finds claude.CMD (so the guard passes), but Python's subprocess/CreateProcess only auto-appends .exe and ignores PATHEXT — so the bare name cannot launch the npm .cmd wrapper → WinError 2.

Reproduction

import subprocess, shutil
print(shutil.which("claude"))                                  # -> ...\claude.CMD  (guard passes)
subprocess.run(["claude", "-p"], input="hi", text=True)        # -> FileNotFoundError [WinError 2]
subprocess.run([shutil.which("claude.cmd"), "-p"], input="hi", text=True)  # -> works, exit 0

Suggested fix

Port the _call_claude_cli resolution into _call_llm's claude-cli branch — prefer shutil.which("claude.cmd") on Windows and invoke the resolved path instead of the bare string. Ideally factor the launcher resolution into one shared helper so the two paths cannot drift again.

Impact

Silent — no error is surfaced to the user; the graph ships with placeholder community names and the failure is only visible by inspecting .graphify_labels.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions