{"record":{"id":"dff3b2507cb0c825","repo":"sipeed/picoclaw","slug":"invalid-skill-frontmatter-w","errorCode":null,"errorMessage":"invalid skill frontmatter: %w","messagePattern":"invalid skill frontmatter: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/evolution/apply.go","lineNumber":260,"sourceCode":"\t\treturn \"\", body\n\t}\n\tend := -1\n\tfor i := 1; i < len(lines); i++ {\n\t\tif strings.TrimSpace(lines[i]) == \"---\" {\n\t\t\tend = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif end < 0 {\n\t\treturn \"\", body\n\t}\n\treturn strings.Join(lines[1:end], \"\\n\"), strings.TrimLeft(strings.Join(lines[end+1:], \"\\n\"), \"\\n\")\n}\n\nfunc parseSkillFrontmatterFields(frontmatter string, allowExtraFields bool) (map[string]string, error) {\n\tvar raw map[string]any\n\tif err := yaml.Unmarshal([]byte(frontmatter), &raw); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid skill frontmatter: %w\", err)\n\t}\n\tfor key := range raw {\n\t\tif key != \"name\" && key != \"description\" {\n\t\t\tif allowExtraFields {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"unsupported skill frontmatter field %q\", key)\n\t\t}\n\t}\n\n\tvar typed struct {\n\t\tName        string `yaml:\"name\"`\n\t\tDescription string `yaml:\"description\"`\n\t}\n\tif err := yaml.Unmarshal([]byte(frontmatter), &typed); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid skill frontmatter: %w\", err)\n\t}\n\treturn map[string]string{","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/evolution/apply.go#L242-L278","documentation":"First pass of parseSkillFrontmatterFields (pkg/evolution/apply.go:260): yaml.Unmarshal of the text between the `---` markers into map[string]any failed, so the frontmatter block is not valid YAML mapping content. The underlying yaml.v3 error is wrapped with %w, preserving its line/column position.","triggerScenarios":"Frontmatter with tab indentation, unterminated quotes, `key: value: value`, a stray `---` or colon structure inside a value, a plain scalar or list instead of `key: value` lines, or markdown prose accidentally inside the block — typically LLM-generated draft bodies where markdown bleeds above the body.","commonSituations":"LLM output malformed under token limits; hand-edited SKILL.md frontmatter; text pasted from terminals introducing tabs; description values containing unquoted colons followed by more text.","solutions":["Read the wrapped yaml.v3 error position and fix that line (quote values containing colons, replace tabs with spaces)","Reduce frontmatter to plain `name:` and `description:` scalar lines","Run yaml.Unmarshal on the extracted block yourself before applying to catch it early"],"exampleFix":"# before\n---\nname: deploy-checks\ndescription: checks: run before deploy   # invalid second colon\n---\n\n# after\n---\nname: deploy-checks\ndescription: \"checks: run before deploy\"\n---","handlingStrategy":"validation","validationCode":"func frontmatterParses(body string) error {\n\tblock := extractFrontmatter(body) // text between the --- markers\n\tif block == \"\" {\n\t\treturn nil\n\t}\n\tvar raw map[string]any\n\tif err := yaml.Unmarshal([]byte(block), &raw); err != nil {\n\t\treturn fmt.Errorf(\"frontmatter YAML invalid: %w\", err)\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := applier.ApplyDraft(ctx, ws, draft); err != nil {\n\tvar yerr *yaml.TypeError\n\tif strings.Contains(err.Error(), \"invalid skill frontmatter\") || errors.As(err, &yerr) {\n\t\t// re-render or hand-fix the draft YAML at the reported line\n\t}\n}","preventionTips":["Keep frontmatter to two simple `key: value` lines and quote values containing colons","Run a YAML lint (yaml.Unmarshal probe) on LLM-generated draft bodies before storing them as candidates","Never paste tab-indented text into frontmatter"],"tags":["go","yaml","frontmatter","parse-error","llm-draft"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}