Tencent/WeKnora · error

failed to read skill directory %s: %w

Error message

failed to read skill directory %s: %w

What it means

Wraps os.ReadDir failure in Loader.discoverInDirectory: the skill directory exists and is a directory (os.Stat succeeded) but reading its entries failed, typically due to permission denied. Missing directories are deliberately skipped silently, so this error means an existing directory could not be enumerated.

Source

Thrown at internal/agent/skills/loader.go:66

	var metadata []*SkillMetadata

	// Check if directory exists
	info, err := os.Stat(dir)
	if err != nil {
		if os.IsNotExist(err) {
			return nil, nil // Directory doesn't exist, skip silently
		}
		return nil, fmt.Errorf("failed to access skill directory %s: %w", dir, err)
	}

	if !info.IsDir() {
		return nil, fmt.Errorf("%s is not a directory", dir)
	}

	// Read directory entries
	entries, err := os.ReadDir(dir)
	if err != nil {
		return nil, fmt.Errorf("failed to read skill directory %s: %w", dir, err)
	}

	for _, entry := range entries {
		if !entry.IsDir() {
			continue
		}

		skillPath := filepath.Join(dir, entry.Name())
		skillFile := filepath.Join(skillPath, SkillFileName)

		// Check if SKILL.md exists
		if _, err := os.Stat(skillFile); os.IsNotExist(err) {
			continue
		}

		// Read and parse SKILL.md
		content, err := os.ReadFile(skillFile)
		if err != nil {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Fix filesystem permissions on the skill directory so the process can read it
  2. Verify the path points to a directory the service user can access
  3. Check for mount/NFS issues if the directory is on shared storage
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/agent/skills/loader.go:66 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/c4443c331516be71. Report an issue: GitHub.