astral-sh/ruff · error

Rule ` ` was removed and cannot be selected.

Error message

Rule `{prefix}{code}` was removed and cannot be selected.

What it means

An anyhow error raised during rule-table resolution: the configuration selects a single rule code that was removed from Ruff in an earlier release. Removed rules cannot be re-enabled, so configuration loading fails with this message naming the offending code.

Solutions

  1. Remove the removed rule code from select/ignore in the configuration
  2. Replace the removed rule with its documented successor, if one exists
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05). Data as JSON: /api/errors/f33defeffe15e30f. Report an issue: GitHub.

Appendix: source

Thrown at crates/ruff_workspace/src/configuration.rs:1138

                    redirected_from: Some(redirect_from),
                    ..
                }
                | RuleSelector::Rule {
                    redirected_from: Some(redirect_from),
                    ..
                } = selector
                {
                    redirects.insert(*redirect_from, selector);
                }
            }
        }

        let removed_selectors = removed_selectors.iter().sorted().collect::<Vec<_>>();
        match removed_selectors.as_slice() {
            [] => (),
            [selection] => {
                let (prefix, code) = selection.prefix_and_code();
                return Err(anyhow!(
                    "Rule `{prefix}{code}` was removed and cannot be selected."
                ));
            }
            [..] => {
                let mut message =
                    "The following rules have been removed and cannot be selected:".to_string();
                for selection in removed_selectors {
                    let (prefix, code) = selection.prefix_and_code();
                    message.push_str("\n    - ");
                    message.push_str(prefix);
                    message.push_str(code);
                }
                message.push('\n');
                return Err(anyhow!(message));
            }
        }

        if !removed_ignored_rules.is_empty() {

View on GitHub (pinned to 26f38c119c)