Skip to content

learn --apply crashes on Windows paths with spaces (FileNotFoundError WinError 161) #997

Description

@Marcdaddy1

Version: 0.20.15
OS: Windows 11
Command: headroom learn --all --apply

Steps to reproduce

  1. Have a Claude Code project in a directory whose path contains spaces
    (e.g. C:\Users\<name>\Desktop\Claude Code Projects)
  2. Run headroom learn --all — dry run completes fine
  3. Run headroom learn --all --apply — crashes

Error

FileNotFoundError: [WinError 161] The specified path is invalid: '\\\\\\Users\\AegeanPulse\\Desktop\\Claude'

Root cause

In headroom/learn/plugins/claude.py, the _decode_project_path() function (and the fallback in discover_projects()) reconstructs a Windows path from Claude Code's encoded project directory name by splitting on - and rejoining with \\:

drive = parts[0].upper()
win_path = Path(f"{drive}:\\" + "\\".join(parts[1:]))

Two issues:

  1. Spaces in directory names are encoded as - (same as path separators), so Claude-Code-Projects is decoded as three separate path components instead of one directory named "Claude Code Projects".
  2. The drive letter f-string (f"{drive}:\\") already ends with a backslash, making the path boundary \\\ (interpreted as UNC) rather than \\.

Expected behaviour

headroom learn --apply writes recommendations to the correct path:
C:\Users\<name>\Desktop\Claude Code Projects\CLAUDE.md

Workaround

Manually apply the recommendations printed by the dry run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions