astral-sh/ruff · error · anyhow::Error
could not find task named `{}`
Error message
could not find task named `{}` What it means
For `show-one`, the harness first finds the truth source whose name matches `cmd.task_name` among the subdirectories of `truth/`; no match aborts here. The expected value is a fixture directory name under `crates/ty_completion_eval/truth` — not a file name, symbol, or CSV task id.
Source
Thrown at crates/ty_completion_eval/src/main.rs:175
let tmp_eval_path = SystemPath::from_std_path(tmp_eval_dir.path())
.ok_or_else(|| {
anyhow::anyhow!(
"Temporary directory path is not valid UTF-8: {}",
tmp_eval_dir.path().display()
)
})?
.to_path_buf();
let sources = TaskSource::all(&truth)?;
match args.command {
Command::ShowOne(ref cmd) => {
tmp_eval_dir.disable_cleanup(cmd.keep_tmp_dir);
let Some(source) = sources
.iter()
.find(|source| cmd.matches_source_task(source))
else {
anyhow::bail!("could not find task named `{}`", cmd.task_name);
};
let tasks = source.to_tasks(&tmp_eval_path)?;
let matching: Vec<&Task> = tasks.iter().filter(|task| cmd.matches_task(task)).collect();
anyhow::ensure!(
!matching.is_empty(),
"could not find any tasks matching the given criteria",
);
anyhow::ensure!(
matching.len() < 2,
"found more than one task matching the given criteria",
);
let task = &matching[0];
let completions = task.completions()?;
let mut stdout = std::io::stdout().lock();
for (i, c) in completions.iter().enumerate() {
write!(stdout, "{}", c.name.as_str())?;
if let Some(module_name) = c.module_name {View on GitHub (pinned to 672bb4edf0)
Solutions
- List available fixtures: `ls crates/ty_completion_eval/truth`
- Use the exact directory name, verbatim and case-sensitive
- Check the fixture's `completion.toml` to confirm you are targeting the intended source
Example fix
# before cargo run -p ty_completion_eval -- show-one custom-type --file-name main.py --index 0 # after (exact fixture directory name) cargo run -p ty_completion_eval -- show-one custom-types --file-name main.py --index 0
Defensive patterns
Strategy: validation
Validate before calling
ls crates/ty_completion_eval/truth | grep -Fx "$FIXTURE" >/dev/null \
|| { echo "unknown fixture: $FIXTURE" >&2; exit 2; } Prevention
- Use fixture directory names from `truth/`, not names from the CSV or logs
- Keep a tab-completion helper (e.g. `ls crates/ty_completion_eval/truth`) handy
- Names are case-sensitive; copy them verbatim
When it happens
Trigger: `ty_completion_eval show-one <name>` where `<name>` is not one of the fixture directories (typo, or a name taken from the completion-evaluation CSV instead of the fixture tree).
Common situations: Copy-pasting names from logs or older fixture layouts after fixtures were renamed; assuming the task name is the Python file name.
Related errors
- could not find any tasks matching the given criteria
- found more than one task matching the given criteria
- {flag} <reason> cannot contain newline characters
- Provided project path `{project}` is not a directory
- {e}
AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16).
Data as JSON: /api/errors/424f86bd33c8e8b7.
Report an issue: GitHub.