Tencent/WeKnora · error

path is required; write a file inside %s

Error message

path is required; write a file inside %s

What it means

resolveSkillFilePath requires a non-empty requested path; when it is empty or whitespace-only it returns "path is required" with the bound skill directory embedded so the model/caller knows where files must be written. It is the first check on the requested path after validating the skill directory itself.

Source

Thrown at internal/agent/tools/skill_file.go:395

	return nil
}

// resolveSkillFilePath turns a model-supplied path into an absolute path
// proven to sit inside skillDir.
//
// A relative path is resolved against skillDir, which is what the model
// reaches for after being told the directory once. Everything is then cleaned
// and re-checked against the prefix, so "..", a symlink-looking spelling or an
// absolute path into a neighbouring skill all fail here rather than reaching
// the image. The directory itself is refused: it is not a file.
func resolveSkillFilePath(skillDir, requested string) (string, error) {
	dir := path.Clean(strings.TrimSpace(skillDir))
	if dir == "" || dir == "." || dir == "/" {
		return "", fmt.Errorf("this tool is not bound to a skill directory")
	}
	trimmed := strings.TrimSpace(requested)
	if trimmed == "" {
		return "", fmt.Errorf("path is required; write a file inside %s", dir)
	}
	if strings.ContainsRune(trimmed, 0) {
		return "", fmt.Errorf("path %q is not a valid file path", requested)
	}
	candidate := trimmed
	if !path.IsAbs(candidate) {
		candidate = path.Join(dir, candidate)
	}
	clean := path.Clean(candidate)
	if clean == dir || !strings.HasPrefix(clean, dir+"/") {
		return "", fmt.Errorf(
			"path %q is outside this install's skill directory (%s); "+
				"an install may only write its own skill",
			requested, dir,
		)
	}
	return clean, nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Pass a non-empty relative path (inside the skill directory) in the tool call.
  2. Validate the path argument exists before invoking Execute.
  3. Re-prompt the model to include the target file path when the argument is blank.

Example fix

// before
in := SkillFileInput{Content: "# Readme"} // path missing
// after
in := SkillFileInput{Path: "README.md", Content: "# Readme"}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(input.Path) == "" {
    return fmt.Errorf("a file path inside %s is required", skillDir)
}

Type guard

func hasPath(in SkillFileInput) bool { return strings.TrimSpace(in.Path) != "" }

Try / catch

if _, err := tool.Execute(ctx, input); err != nil && strings.Contains(err.Error(), "path is required") {
    // re-request the path from the model or supply a default filename
}

Prevention

When it happens

Trigger: Calling Execute (write-file operation) with an empty or blank requested path argument — e.g. the model's tool call omitted the path key or passed "" / " ".

Common situations: Model emits a write call with only content but no path; programmatic callers forget the path field; template prompts that leave the path placeholder unfilled.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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