Skip to content

[Bug]: Agent SKILL.md parser fails for non-strings frontmatter, blocks loading of the skill #1030

@alexcheng1982

Description

@alexcheng1982

Describe the bug
MarkdownSkillParser uses a simple YAML parser to parse frontmatter of SKILL.md. This doesn't work for many skills with lists and multiline texts in the frontmatter, especially those used by OpenClaw.

For example, the Agent Browser skill has the following frontmatter. Using this skill will result in parsing error.

---
name: Agent Browser
description: A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured commands.
read_when:
  - Automating web interactions
  - Extracting structured data from pages
  - Filling forms programmatically
  - Testing web UIs
metadata: {"clawdbot":{"emoji":"🌐","requires":{"bins":["node","npm"]}}}
allowed-tools: Bash(agent-browser:*)
---

To Reproduce
Steps to reproduce the behavior:

  1. Download the zip file of Agent Browser skill
  2. Extract it into a directory
  3. Use FileSystemSkillRepository to load this skill

Expected behavior
There should be no parsing error and skill can be loaded.

Error messages

java.lang.IllegalArgumentException: Invalid YAML line (expected 'key: value' format):   - Automating web interactions
	at io.agentscope.core.skill.util.MarkdownSkillParser$SimpleYamlParser.parse(MarkdownSkillParser.java:187)
	at io.agentscope.core.skill.util.MarkdownSkillParser.parse(MarkdownSkillParser.java:106)
	at io.agentscope.core.skill.util.SkillUtil.createFrom(SkillUtil.java:89)
	at io.agentscope.core.skill.util.SkillFileSystemHelper.loadSkillFromDirectory(SkillFileSystemHelper.java:98)
	at io.agentscope.core.skill.util.SkillFileSystemHelper.lambda$getAllSkills$4(SkillFileSystemHelper.java:145)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
	at io.agentscope.core.skill.util.SkillFileSystemHelper.getAllSkills(SkillFileSystemHelper.java:141)
	at io.agentscope.core.skill.repository.FileSystemSkillRepository.getAllSkills(FileSystemSkillRepository.java:119)

Environment (please complete the following information):

  • AgentScope-Java Version: 1.0.9
  • Java Version: 21
  • OS: macos

Additional context

When the YAML parser encountered invalid keys, it should log out the error and continue, instead of throwing an exception, see the code. This makes the parser more tolerant to markdown errors in SKILL.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions