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

Selection of deprecated rules is not allowed when preview is

Error message

Selection of deprecated rules is not allowed when preview is enabled. Remove selection of:

What it means

Error "Selection of deprecated rules is not allowed when preview is enabled. Remove selection of:" thrown in astral-sh/ruff.

Source

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

                    let (prefix, code) = selection.prefix_and_code();
                    return Err(anyhow!(
                        "Selection of deprecated rule `{prefix}{code}` is not allowed when \
                         preview is enabled."
                    ));
                }
                [..] => {
                    let mut message = "\
                        Selection of deprecated rules is not allowed \
                            when preview is enabled. Remove selection of:"
                        .to_string();
                    for selection in deprecated_selectors {
                        let (prefix, code) = selection.prefix_and_code();
                        message.push_str("\n\t- ");
                        message.push_str(prefix);
                        message.push_str(code);
                    }
                    message.push('\n');
                    return Err(anyhow!(message));
                }
            }
        }

        for selection in ignored_preview_selectors.iter().sorted() {
            let (prefix, code) = selection.prefix_and_code();
            warn_user_once_by_message!(
                "Selection `{prefix}{code}` has no effect because preview is not enabled.",
            );
        }

        let mut rules = RuleTable::empty();

        for rule in select_set {
            let fix = fixable_set.contains(rule);
            rules.enable(rule, fix);
        }

View on GitHub (pinned to 672bb4edf0)

When it happens

Trigger: Thrown at crates/ruff_workspace/src/configuration.rs:1197 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/e6db55516dfdd13a. Report an issue: GitHub.