rulesync icon indicating copy to clipboard operation
rulesync copied to clipboard

Error: Invalid frontmatter when importing Claude commands

Open KrustyHack opened this issue 10 months ago • 7 comments

Ay,

[rulesync 12:04:30 PM]  ERROR  Error: Invalid frontmatter in /xxx/.claude/commands/save-requirement.md: Zod raw error: [{"expected":"string","code":"invalid_type","path":["argument-hint"],"message":"Invalid input: expected string, received array"}]

When trying to do rulesync import --targets claudecode --features rules,mcp,commands,subage nts

Example in one of my .claude command file :

---
description: Break down a requirement into AI-generated tasks
allowed-tools: >-
  Bash(braingrid:*), Bash(git:*), Bash(npm:*), Read, Grep, Glob,
  Skill(braingrid-cli)
argument-hint: [requirement-id]
---

Expected : [] format should work when importing commands with rulesync.

KrustyHack avatar Jan 11 '26 11:01 KrustyHack

@KrustyHack Thank you. It seems a bug.

cm-dyoshikawa avatar Jan 14 '26 07:01 cm-dyoshikawa

I looked into this — it's not clearly a bug, but rather a YAML syntax issue.

argument-hint: [requirement-id] is parsed by YAML as an array ["requirement-id"], not a string. Quoting it fixes the issue:

argument-hint: "[requirement-id]"

For reference:

saitota avatar Feb 26 '26 15:02 saitota

Mind closing this? @dyoshikawa @KrustyHack

saitota avatar Mar 05 '26 13:03 saitota

Not sure because the frontmatter wasn't generated by me but by rulesync.

So yes, if I modify the front matter myself, it will work.

But in this case, it was generated automatically by rulesync.

KrustyHack avatar Mar 05 '26 13:03 KrustyHack

I couldn't reproduce this with the current version. Could you share the exact steps to reproduce? Specifically, what files you had and where, and what command you ran. @KrustyHack

saitota avatar Mar 07 '26 14:03 saitota

Ok maybe it was with the old version then. I don't use rulesync anymore at the moment. But if you validated it then I think this "bug" could be closed. 👍

KrustyHack avatar Mar 09 '26 10:03 KrustyHack

@saitota Thank you for the handling it!

cm-dyoshikawa avatar Mar 09 '26 10:03 cm-dyoshikawa