nikivdev/code · error
Tool '{}' not found. Create it with: f tools new {}
Error message
Tool '{}' not found. Create it with: f tools new {} What it means
Raised by run_tool (src/tools.rs:129) when the requested tool's source file <tools_dir>/<name>.ts does not exist. The tool runner executes tools via bun, so it requires the .ts file to be present and suggests scaffolding it with `f tools new <name>`.
Source
Thrown at src/tools.rs:129
if trimmed.starts_with("///") {
return Some(trimmed.trim_start_matches("///").trim().to_string());
}
// Skip empty lines at the top
if !trimmed.is_empty() && !trimmed.starts_with("//") {
break;
}
}
None
}
/// Run a tool via bun.
fn run_tool(name: &str, args: Vec<String>) -> Result<()> {
let tools_dir = get_tools_dir()?;
let tool_file = tools_dir.join(format!("{}.ts", name));
if !tool_file.exists() {
bail!(
"Tool '{}' not found. Create it with: f tools new {}",
name,
name
);
}
let status = Command::new("bun")
.arg("run")
.arg(&tool_file)
.args(&args)
.status()
.context("failed to run bun")?;
if !status.success() {
bail!("Tool '{}' exited with status: {}", name, status);
}
Ok(())View on GitHub (pinned to a747e741ae)
Solutions
- Run `f tools new <name>` to scaffold the missing tool.
- List existing tools in the tools directory to check the exact spelling (`ls $(f tools dir)` or similar).
- If the tool lived on another machine, copy/sync the tools directory first.
- If you only need a one-off, write the tool file directly as a TypeScript file in the tools dir.
Example fix
// before f deploy-stagging // after: create the correctly named tool, then run it f tools new deploy-staging f deploy-staging
Defensive patterns
Strategy: validation
Validate before calling
const fs = require("fs"), path = require("path");
const toolsDir = process.env.F_TOOLS_DIR || path.join(process.env.HOME, ".config", "f", "tools");
if (!fs.existsSync(path.join(toolsDir, name + ".ts"))) {
console.error(`tool ${name} missing; run: f tools new ${name}`);
} Try / catch
try {
runTool(name);
} catch (e) {
if (String(e).includes("not found. Create it with")) {
execSync(`f tools new ${name}`);
} else throw e;
} Prevention
- Keep the tools directory synced across machines (dotfiles repo).
- Fix typos by listing available tools before invoking an unfamiliar name.
- Update shell aliases/scripts when a tool is renamed.
When it happens
Trigger: Calling `f <toolname>` (via run → run_tool) with a tool name that was never created, a misspelled name, or before the tools directory has been initialized/set up (get_tools_dir resolves but contains no such file).
Common situations: Typo in the tool name on the command line; switching machines where ~/.config tools dir was not synced; tool renamed but old invocations cached in shell aliases/scripts.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Session '{}' not found in saved sessions
- Project not found. Create it with `f env push` first.
- Key '{}' not found
- No running process found for task '{}'
- Project '{}' not found. Use `f projects` to see registered p
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/9438f6c3f0278642.
Report an issue: GitHub.