astral-sh/ruff · error · anyhow::Error

Required version `{required_version}` does not match the run

Error message

Required version `{required_version}` does not match the running version `{RUFF_PKG_VERSION}`

What it means

Error "Required version `{required_version}` does not match the running version `{RUFF_PKG_VERSION}`" thrown in astral-sh/ruff.

Source

Thrown at crates/ruff_workspace/src/options.rs:613

    /// For example, `TC001`, `TC002`, and `TC003` can move more imports into `TYPE_CHECKING` blocks
    /// if `__future__` annotations are enabled.
    ///
    #[option(
        default = "false",
        value_type = "bool",
        example = r#"
            # Enable `from __future__ import annotations` imports
            future-annotations = true
        "#
    )]
    pub future_annotations: Option<bool>,
}

pub(crate) fn validate_required_version(required_version: &RequiredVersion) -> anyhow::Result<()> {
    let ruff_pkg_version = pep440_rs::Version::from_str(RUFF_PKG_VERSION)
        .expect("RUFF_PKG_VERSION is not a valid PEP 440 version specifier");
    if !required_version.contains(&ruff_pkg_version) {
        return Err(anyhow::anyhow!(
            "Required version `{required_version}` does not match the running version \
            `{RUFF_PKG_VERSION}`"
        ));
    }
    Ok(())
}

/// Newtype wrapper for [`LintCommonOptions`] that allows customizing the JSON schema and omitting the fields from the [`OptionsMetadata`].
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize)]
#[serde(transparent)]
pub struct DeprecatedTopLevelLintOptions(pub(crate) LintCommonOptions);

impl<'de> Deserialize<'de> for DeprecatedTopLevelLintOptions {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        // Temporarily disable span information because the flattened values don't retain spans.

View on GitHub (pinned to 672bb4edf0)

When it happens

Trigger: Thrown at crates/ruff_workspace/src/options.rs:613 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16). Data as JSON: /api/errors/fa96cbb013b12f51. Report an issue: GitHub.