Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

scan-path-standards.py aborts the whole scan on a non-UTF-8 file #159

Open

Description

@armelhbobdad

scan-path-standards.py aborts the whole scan when any .md or .json file under the skill is not valid UTF-8, so a skill that ships a deliberately undecodable test fixture cannot be path-scanned at all.

Reproduce (v2.2.2, also on main)

mkdir -p repro/docs
printf -- '---\nname: repro\ndescription: repro\n---\n\n# Repro\n' > repro/SKILL.md
python3 -c "open('repro/docs/utf16.md','wb').write('# Fixture\n'.encode('utf-16'))"
uv run skills/bmad-workflow-builder/scripts/scan-path-standards.py repro
  File ".../scan-path-standards.py", line 135, in scan_file
    content = filepath.read_text(encoding='utf-8')
  ...
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

The exit code is 1 and stdout is empty.

Where

  • skills/bmad-workflow-builder/scripts/scan-path-standards.py: scan_file() calls filepath.read_text(encoding='utf-8') (line 135) with no guard, for every file scan_skill() collects with rglob('*.md') and rglob('*.json').
  • skills/bmad-agent-builder/scripts/scan-path-standards.py is the same.

Why it matters

The Analyze pre-pass (references/scan-orchestration.md) runs this scanner and hands its JSON to the lenses. When the scanner crashes, that JSON is empty or missing. A run that redirects stdout to a file is left with a zero-byte file, which is easy to read as a clean scan. Skills with tests often keep a non-UTF-8 fixture on purpose, for example a UTF-16 file a test asserts is reported as unreadable, so the crash can't be fixed in the skill.

Suggested fix

In scan_file(), catch UnicodeDecodeError (and OSError) around the read, then either:

  • record the file as skipped in the output, for example in files_skipped with the reason; or
  • emit one low-severity finding,

and go on to the next file. That way one undecodable file never discards the rest of the scan. Skipping tests/, fixtures/ and dot-directories by default would also cut a lot of noise from skills that ship tests.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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