Hmbown/CodeWhale · error · anyhow::Error
Write tool did not expose a bounded repo-relative target…
Error message
Write tool {name} did not expose a bounded repo-relative target for coordination What it means
A scope-aware write tool (write/edit/patch-like actions, or pandoc_convert with an output_path) was called under `enforce_write_claim`, but `mutation_paths` could not extract any concrete repo-relative target from the tool input. The coordination layer cannot claim/validate a write scope for a pathless mutation, so the call is refused.
Solutions
- Re-issue the tool call with the correct path field populated and repo-relative (e.g. `file_path: "src/foo.rs"`).
- Fix the input schema so the tool exposes a target the coordination layer recognizes (for pandoc_convert set `output_path`).
- If this is a legitimately non-file write, adjust the tool catalog/mutation_paths mapping rather than bypassing the claim check.
Example fix
// before
{"tool":"edit","input":{"path":""}}
// after
{"tool":"edit","input":{"file_path":"src/main.rs"}} Defensive patterns
Strategy: validation
Validate before calling
let path = input.get("file_path").or_else(|| input.get("output_path")).and_then(Value::as_str);
if path.map(str::is_empty).unwrap_or(true) {
return Err("write tool requires a repo-relative target path");
} Type guard
fn has_bounded_target(name: &str, input: &Value) -> bool {
input.get("file_path").and_then(Value::as_str)
.map(|p| !p.is_empty() && Path::new(p).is_relative())
.unwrap_or(false)
|| (name == "pandoc_convert" && input.get("output_path").and_then(Value::as_str).is_some())
} Try / catch
match result {
Err(e) if e.to_string().contains("did not expose a bounded repo-relative target") => {
// repair input path field and retry
}
other => other?,
} Prevention
- Always emit the canonical path key (file_path / output_path) for write tools.
- Use repo-relative paths inside the checkout.
- Validate write inputs against the tool schema before calling.
- Keep mutation_paths mappings in sync when adding custom write tools.
When it happens
Trigger: Invoking a write-family tool with malformed or missing path fields (e.g. empty `file_path`, relative path outside repo, or an input shape `mutation_paths` does not recognize) while write-claim enforcement is on for the sub-agent.
Common situations: Model emitting write input with the wrong key name; empty path string; attempting an absolute path outside the repo that the path extractor drops; custom tools tagged as writes without standard path arguments.
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
- Tool cannot prove a bounded file target or read-only…
- Agent continuation target is no longer retained
- Agent continuation target is outside the active session
- Agent not found
- Agent session not found
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/617249ea66360b13.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/mod.rs:17591
spec.as_ref(),
self.execution_envelope(),
self.bounded_readonly_bash_evidence(name, &input),
)
.map_err(|refusal| anyhow!(refusal))?;
}
let scope_aware_write = matches!(
name,
"write" | "edit" | "write_file" | "edit_file" | "apply_patch" | "fim_edit"
) || (name == "File"
&& input
.get("action")
.and_then(Value::as_str)
.is_some_and(|action| matches!(action, "write" | "edit" | "patch")))
|| (name == "pandoc_convert" && input.get("output_path").is_some());
if scope_aware_write && self.enforce_write_claim {
let paths = mutation_paths(name, &input)?;
if paths.is_empty() {
return Err(anyhow!(
"Write tool {name} did not expose a bounded repo-relative target for coordination"
));
}
let manager = self.coordination_manager.read().await;
manager
.validate_write_scope(&self.owner_agent_id, &paths)
.map_err(anyhow::Error::msg)?;
} else if self.enforce_write_claim
// The typed read-only boundary above already rejected mutation.
&& !self.write_is_denied()
&& !is_internal_coordination_state_tool(name)
// A shell run the read-only classifier proves mutation-free cannot
// collide with the peer's writes no matter how contended the
// checkout is, so the gate below does not apply to it.
&& !proven_readonly_shell_run(name, &input)
&& (is_unbounded_shell_run(name, &input)
|| self.registry.get(name).is_some_and(|spec| {
let canonical = canonical_action_alias(name, &input);View on GitHub (pinned to 433685b202)