rust-lang/cargo · error
Could not find typos version in workflow
Error message
Could not find typos version in workflow
What it means
xtask-spellcheck parses the GitHub Actions workflow file to find the pinned `crate-ci/typos` version (the `uses: crate-ci/typos@vX.Y.Z` line) and parses it as a semver Version. If no such line is found, it bails with 'Could not find typos version in workflow'.
Source
Thrown at crates/xtask-spellcheck/src/main.rs:130
}
fn extract_workflow_typos_version(metadata: &Metadata) -> anyhow::Result<Version> {
let ws_root = metadata.workspace_root.as_path().as_std_path();
let workflow_path = ws_root.join(".github").join("workflows").join("main.yml");
let file_content = std::fs::read_to_string(workflow_path)?;
extract_typos_version_from_content(&file_content)
}
fn extract_typos_version_from_content(file_content: &str) -> anyhow::Result<Version> {
file_content
.lines()
.find_map(|line| {
line.trim()
.strip_prefix("uses: crate-ci/typos@v")
.and_then(|v| Version::parse(v).ok())
})
.ok_or_else(|| anyhow::anyhow!("Could not find typos version in workflow"))
}
/// If the given executable is installed with the given version, use that,
/// otherwise install via cargo.
pub fn ensure_version_or_cargo_install(
build_dir: &Path,
required_version: Version,
) -> io::Result<PathBuf> {
// Check if the user has a sufficient version already installed
let bin_path = PathBuf::from(BIN_NAME).with_extension(env::consts::EXE_EXTENSION);
if let Some(user_version) = get_typos_version(&bin_path) {
if user_version >= required_version {
return Ok(bin_path);
}
}
let tool_root_dir = build_dir.join("misc-tools");
let tool_bin_dir = tool_root_dir.join("bin");View on GitHub (pinned to eb98b54bc9)
Solutions
- Restore a `uses: crate-ci/typos@vX.Y.Z` line in the spellcheck GitHub Actions workflow file.
- Update extract_typos_version_from_content's prefix matching if the workflow legitimately changed format.
- Pin a concrete version tag (vX.Y.Z) rather than a branch/sha so the semver parse succeeds.
Example fix
// before (workflow) - uses: crate-ci/typos@master // after - uses: crate-ci/typos@v1.20.0
Defensive patterns
Strategy: validation
Validate before calling
// Verify the workflow references typos with a version tag
let wf = std::fs::read_to_string(workflow_path)?;
if !wf.contains("uses: crate-ci/typos@v") {
eprintln!("workflow missing crate-ci/typos@vX.Y.Z reference");
} Type guard
null
Try / catch
null
Prevention
- Pin typos to a vX.Y.Z tag in the workflow.
- Keep the prefix 'uses: crate-ci/typos@v' stable when editing CI.
When it happens
Trigger: Running `cargo spellcheck` when the workflow file no longer contains a `uses: crate-ci/typos@v...` line (renamed action, changed format, missing tag prefix), so Version::parse never succeeds.
Common situations: Editing the CI workflow to use a fork or a different action reference; bumping via dependabot that changes the line format; removing the typos step; the workflow path moved.
Related errors
- Detected changes in these crates but no version bump found:
- could not find `base-sha` for `{UPSTREAM_BRANCH}`, pass it i
- argument for --color must be auto, always, or never, but fou
- The lints documentation is out-of-date. Run `cargo lint-docs
- failed to parse the version requirement `{}` for dependency
AI-assisted analysis of rust-lang/cargo@eb98b54bc9 (2026-08-11).
Data as JSON: /api/errors/47af10635327aba5.
Report an issue: GitHub.