Skip to content

Windows: skill not discovered due to UTF-8 BOM injected by PowerShell WriteAllText #66479

@ianpor

Description

@ianpor

Summary

On Windows, a skill can disappear from openclaw skills list if SKILL.md starts with a UTF-8 BOM (EF BB BF).

This happens when the file is edited with PowerShell / .NET WriteAllText using the default UTF-8 encoding behaviour. The parser in extractFrontmatterBlock fails silently because it checks whether the content starts with ---, but the BOM comes first.

Reproduction

  1. Install a skill on Windows.
  2. Edit SKILL.md using PowerShell WriteAllText without explicitly using new UTF8Encoding($false).
  3. This writes the file with a UTF-8 BOM.
  4. Run openclaw skills list.

Actual behaviour

The skill disappears from openclaw skills list.

Expected behaviour

The skill should still be discovered even if SKILL.md begins with a UTF-8 BOM.

Root cause

extractFrontmatterBlock in frontmatter-CAnFi2D6.js checks whether the file content starts with ---.

When the file starts with a BOM, the first character is \uFEFF, so the frontmatter check fails.

Proposed fix

Strip a leading BOM before checking for frontmatter:

content = content.replace(/^\uFEFF/, '')

Then proceed with the existing content.startsWith('---') logic.

Why this matters

This is an easy Windows footgun because PowerShell / .NET file-writing paths commonly produce BOM-prefixed UTF-8 unless explicitly configured otherwise. The current failure mode is silent, which makes the bug hard to diagnose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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