{"record":{"id":"f2dcd7a5a2d4119a","repo":"astral-sh/ruff","slug":"could-not-find-any-tasks-matching-the-given-criter","errorCode":null,"errorMessage":"could not find any tasks matching the given criteria","messagePattern":"could not find any tasks matching the given criteria","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":179,"sourceCode":"                tmp_eval_dir.path().display()\n            )\n        })?\n        .to_path_buf();\n\n    let sources = TaskSource::all(&truth)?;\n    match args.command {\n        Command::ShowOne(ref cmd) => {\n            tmp_eval_dir.disable_cleanup(cmd.keep_tmp_dir);\n\n            let Some(source) = sources\n                .iter()\n                .find(|source| cmd.matches_source_task(source))\n            else {\n                anyhow::bail!(\"could not find task named `{}`\", cmd.task_name);\n            };\n            let tasks = source.to_tasks(&tmp_eval_path)?;\n            let matching: Vec<&Task> = tasks.iter().filter(|task| cmd.matches_task(task)).collect();\n            anyhow::ensure!(\n                !matching.is_empty(),\n                \"could not find any tasks matching the given criteria\",\n            );\n            anyhow::ensure!(\n                matching.len() < 2,\n                \"found more than one task matching the given criteria\",\n            );\n            let task = &matching[0];\n            let completions = task.completions()?;\n\n            let mut stdout = std::io::stdout().lock();\n            for (i, c) in completions.iter().enumerate() {\n                write!(stdout, \"{}\", c.name.as_str())?;\n                if let Some(module_name) = c.module_name {\n                    write!(stdout, \" (module: {module_name})\")?;\n                }\n                if task.cursor.answer.matches(c) {\n                    write!(stdout, \" (*, {}/{})\", i + 1, completions.len())?;","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_completion_eval/src/main.rs#L161-L197","documentation":"After the fixture name matches, `show-one` filters the fixture's parsed `<CURSOR>` tasks by the optional `--file-name` and `--index` criteria (`matches_task` requires equality on whichever filters are given); if no task survives, this guard fires. Values must correspond exactly to a Python file inside the fixture and a zero-based cursor index within that file.","triggerScenarios":"A `--file-name` that is not among the fixture's files (wrong path or spelling), an `--index` at or beyond the number of `<CURSOR>` directives in that file, or filters written for a different fixture than the one named.","commonSituations":"Reading (fixture, file, index) triples from the completion-evaluation CSV and transcribing them incorrectly; assuming 1-based cursor indexes; referencing a file that only exists in another fixture.","solutions":["Check valid combinations in `crates/ty_completion_eval/completion-evaluation-tasks.csv` for the fixture you named","Re-run with only `--file-name` to confirm the file exists in the fixture, then pick an index that is listed","Count the `<CURSOR>` directives in the fixture file with `grep -c '<CURSOR' <file>` and use an index below that count"],"exampleFix":"# before (index 9 does not exist in the file)\ncargo run -p ty_completion_eval -- show-one custom-types --file-name main.py --index 9\n# after\ncargo run -p ty_completion_eval -- show-one custom-types --file-name main.py --index 0","handlingStrategy":"validation","validationCode":"grep \"^$FIXTURE\" crates/ty_completion_eval/completion-evaluation-tasks.csv | grep \"$FILE_NAME\" >/dev/null \\\n  || { echo \"no task for fixture=$FIXTURE file=$FILE_NAME\" >&2; exit 2; }\n# also: INDEX must satisfy 0 <= INDEX < $(grep -c '<CURSOR' \"truth/$FIXTURE/**/$FILE_NAME\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Take (fixture, file, index) triples from the committed CSV, not memory","Remember indexes are zero-based","Count `<CURSOR` markers in the fixture file when picking an index"],"tags":["evaluation","cli","validation","filters"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}