astral-sh/ruff · error
could not find any `<CURSOR>` directives in any of the files
Error message
could not find any `<CURSOR>` directives in any of the files in `{src_dir}` What it means
`to_tasks` copies the fixture into the temp dir while stripping `<CURSOR ...>` directives and recording their offsets; if not a single directive is found in any file under the fixture's source directory, this guard fires. Every eval fixture must contain at least one `<CURSOR [expected-module.]expected-symbol>` marker in a Python file — the markers are what define tasks.
Source
Thrown at crates/ty_completion_eval/src/main.rs:577
let src = SystemPath::from_std_path(dent.path()).ok_or_else(|| {
anyhow::anyhow!("path `{}` is not valid UTF-8", dent.path().display())
})?;
let name = src
.strip_prefix(src_dir)
.expect("descendent of `src_dir` must start with `src`");
// let name = src
// .file_name()
// .ok_or_else(|| anyhow::anyhow!("path `{src}` is missing a basename"))?;
let dst = dst_dir.join(name);
if dent.file_type().is_dir() {
std::fs::create_dir_all(dst.as_std_path())
.with_context(|| format!("failed to create directory `{dst}`"))?;
} else {
cursors.extend(copy_file(src, &dst)?);
}
}
anyhow::ensure!(
!cursors.is_empty(),
"could not find any `<CURSOR>` directives in any of the files in `{src_dir}`",
);
Ok(cursors)
}
/// Copies `src` to `dst` while looking for cursor directives.
///
/// Each cursor directive looks like:
/// `<CURSOR [expected-module.]expected-symbol>`.
///
/// When occurrences of cursor directives are found, then they are
/// replaced with the empty string. The position of each occurrence is
/// recorded, which points to the correct place in a document where all
/// cursor directives are omitted.
///
/// # Errors
///View on GitHub (pinned to 672bb4edf0)
Solutions
- Add at least one directive to a Python file in the fixture, e.g. `os.<CURSOR path>` (cursor after `os.`, expecting completion `path`)
- Verify with `grep -rn '<CURSOR' <fixture-dir>` that at least one marker exists in files that get copied
- Check the directive syntax matches `<CURSOR [expected-module.]expected-symbol>` exactly
Example fix
# before (fixture/src/scratch.py — no directives) import os print(os) # after import os print(os.<CURSOR path>)
Defensive patterns
Strategy: validation
Validate before calling
grep -rq '<CURSOR' "$FIXTURE_DIR" \
|| { echo "fixture has no <CURSOR> directives; add at least one" >&2; exit 2; } Prevention
- Every fixture needs at least one `<CURSOR [expected-module.]expected-symbol>` marker in a Python file
- Validate new fixtures with `grep -rn '<CURSOR' <fixture>` before running the harness
- Follow the directive syntax exactly; markers must live in files that get copied
When it happens
Trigger: Adding a new truth fixture whose Python files contain no `<CURSOR>` annotations; annotating non-Python files or files outside the copied source tree; a directive spelling the copier does not recognize.
Common situations: First-time fixture authorship (forgot the markers); refactors that rename or move the directive format; fixtures copied from real projects without adding markers.
Related errors
- could not find task named `{}`
- The `{SECTION_CONFIG_SNAPSHOT}` directive does not take a va
- The current working directory `{}` contains non-Unicode char
- {truth} does not exist: ty's completion evaluation must be r
- Temporary directory path is not valid UTF-8: {}
AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16).
Data as JSON: /api/errors/0f7a8a2c65c73840.
Report an issue: GitHub.