Tencent/WeKnora · error

file_path belongs to skill %q; call read_skill(skill_name=%q

Error message

file_path belongs to skill %q; call read_skill(skill_name=%q, file_path=...)

What it means

Skill-file path routing guard: the absolute file_path resolves inside a different skill's image directory (derived via SkillNameFromImagePath) than the skill being read, so the helper rejects it and redirects the caller to read_skill with the owning skill's name to prevent cross-skill file access.

Source

Thrown at internal/agent/tools/skill_read.go:261

// works. Workspace paths are rejected here; they belong to other tools.
func skillRelativeFilePath(skillName, filePath string) (string, error) {
	trimmed := strings.TrimSpace(filePath)
	if trimmed == "" {
		return "", nil
	}
	clean := path.Clean(trimmed)
	if path.IsAbs(trimmed) {
		dir, err := sandbox.SkillDirFor(skillName)
		if err == nil {
			if clean == dir {
				return "", nil
			}
			if strings.HasPrefix(clean, dir+"/") {
				return strings.TrimPrefix(clean, dir+"/"), nil
			}
		}
		if other, inImage := sandbox.SkillNameFromImagePath(clean); inImage && other != "" && other != skillName {
			return "", fmt.Errorf(
				"file_path belongs to skill %q; call read_skill(skill_name=%q, file_path=...)",
				other, other,
			)
		}
		return "", fmt.Errorf(
			"file_path must be relative inside the skill (e.g. scripts/generate_ppt.py), not %s",
			filePath,
		)
	}
	prefix := skillName + "/"
	if strings.HasPrefix(clean, prefix) {
		return strings.TrimPrefix(clean, prefix), nil
	}
	return clean, nil
}

// Cleanup releases any resources (implements Tool interface if needed)
func (t *ReadSkillTool) Cleanup(ctx context.Context) error {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Call read_skill with skill_name set to the skill that owns the file
  2. Keep file_path relative to the current skill
  3. Do not reference another skill's image paths directly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/agent/tools/skill_read.go:261 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/ffa1c0b235115b7c. Report an issue: GitHub.