Tencent/WeKnora · error

error reading SKILL.md: %w

Error message

error reading SKILL.md: %w

What it means

I/O wrapper in ParseSkillFile: bufio.Scanner.Err() was non-nil after scanning the SKILL.md content, meaning reading the input stream itself failed (I/O error), as opposed to a formatting problem. Content-format issues are reported by later checks like the unclosed-frontmatter error.

Source

Thrown at internal/agent/skills/skill.go:198

			inFrontmatter = true
			continue
		}

		if inFrontmatter && strings.TrimSpace(line) == "---" {
			inFrontmatter = false
			frontmatterEnded = true
			continue
		}

		if inFrontmatter {
			frontmatterLines = append(frontmatterLines, line)
		} else if frontmatterEnded {
			bodyLines = append(bodyLines, line)
		}
	}

	if err := scanner.Err(); err != nil {
		return nil, fmt.Errorf("error reading SKILL.md: %w", err)
	}

	if !frontmatterEnded {
		return nil, errors.New("SKILL.md frontmatter is not properly closed with ---")
	}

	// Parse YAML frontmatter
	frontmatter := strings.Join(frontmatterLines, "\n")
	repaired, err := UnmarshalSkillFrontmatter(frontmatter, skill)
	if err != nil {
		return nil, fmt.Errorf("failed to parse YAML frontmatter: %w", err)
	}
	skill.FrontmatterRepaired = repaired
	if err := skill.applyInstallName(); err != nil {
		return nil, err
	}

	// Set body instructions

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Retry reading the SKILL.md source; check for transient I/O failures
  2. Verify the SKILL.md file is readable and not truncated/corrupted
  3. Check encoding issues (invalid UTF-8 can fail the scanner) and re-save as UTF-8
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/agent/skills/skill.go:198 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/07ed25f994a08687. Report an issue: GitHub.