{"record":{"id":"6782ed46d186ef1a","repo":"astral-sh/ruff","slug":"selection-of-deprecated-rule-prefix-code-is-n","errorCode":null,"errorMessage":"Selection of deprecated rule `{prefix}{code}` is not allowed when preview is enabled.","messagePattern":"Selection of deprecated rule `(.+?)(.+?)` is not allowed when preview is enabled\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_workspace/src/configuration.rs","lineNumber":1189,"sourceCode":"            let (prefix, code) = target.prefix_and_code();\n            // TODO(martin): This belongs into the ruff crate.\n            warn_user_once_by_id!(from, \"`{from}` has been remapped to `{prefix}{code}`.\");\n        }\n\n        if preview.mode.is_disabled() {\n            for selection in deprecated_selectors.iter().sorted() {\n                let (prefix, code) = selection.prefix_and_code();\n                warn_user_once_by_message!(\n                    \"Rule `{prefix}{code}` is deprecated and will be removed in a future release.\"\n                );\n            }\n        } else {\n            let deprecated_selectors = deprecated_selectors.iter().sorted().collect::<Vec<_>>();\n            match deprecated_selectors.as_slice() {\n                [] => (),\n                [selection] => {\n                    let (prefix, code) = selection.prefix_and_code();\n                    return Err(anyhow!(\n                        \"Selection of deprecated rule `{prefix}{code}` is not allowed when \\\n                         preview is enabled.\"\n                    ));\n                }\n                [..] => {\n                    let mut message = \"\\\n                        Selection of deprecated rules is not allowed \\\n                            when preview is enabled. Remove selection of:\"\n                        .to_string();\n                    for selection in deprecated_selectors {\n                        let (prefix, code) = selection.prefix_and_code();\n                        message.push_str(\"\\n\\t- \");\n                        message.push_str(prefix);\n                        message.push_str(code);\n                    }\n                    message.push('\\n');\n                    return Err(anyhow!(message));\n                }","sourceCodeStart":1171,"sourceCodeEnd":1207,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_workspace/src/configuration.rs#L1171-L1207","documentation":"An anyhow error raised when preview mode is enabled and the configuration still selects a deprecated rule. Under preview, deprecated rule selection is a hard error (it would silently change behavior once the rule is removed), so configuration loading aborts naming the code.","triggerScenarios":"Thrown at crates/ruff_workspace/src/configuration.rs:1189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the deprecated rule code from the configuration","Disable preview mode if the deprecated rule must still be used"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}