{"record":{"id":"0233bfb24f902ebd","repo":"astral-sh/ruff","slug":"expected-prefix-string-to-be-non-empty","errorCode":null,"errorMessage":"expected prefix string to be non-empty","messagePattern":"expected prefix string to be non-empty","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_macros/src/rule_namespace.rs","lineNumber":53,"sourceCode":"            .filter(|attr| attr.path().is_ident(\"prefix\"))\n            .map(|attr| {\n                let Meta::NameValue(MetaNameValue {\n                    value:\n                        syn::Expr::Lit(ExprLit {\n                            lit: Lit::Str(lit), ..\n                        }),\n                    ..\n                }) = &attr.meta\n                else {\n                    return Err(Error::new(\n                        attr.span(),\n                        r#\"expected attribute to be in the form of [#prefix = \"...\"]\"#,\n                    ));\n                };\n                let str = lit.value();\n                match str.chars().next() {\n                    None => {\n                        return Err(Error::new(\n                            lit.span(),\n                            \"expected prefix string to be non-empty\",\n                        ));\n                    }\n                    Some(c) => {\n                        if !first_chars.insert(c) {\n                            return Err(Error::new(\n                                lit.span(),\n                                format!(\n                                    \"this variant already has another prefix \\\n                                    starting with the character '{c}'\"\n                                ),\n                            ));\n                        }\n                    }\n                }\n                if !all_prefixes.insert(str.clone()) {\n                    return Err(Error::new(","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_macros/src/rule_namespace.rs#L35-L71","documentation":"A syn compile error from the RuleNamespace derive: a #[prefix = \"...\"] attribute's string value is empty. Rule prefixes must be non-empty because the first character is used to route codes to linters.","triggerScenarios":"Thrown at crates/ruff_macros/src/rule_namespace.rs:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty prefix string such as \"E\"","Remove the empty prefix attribute if the variant needs none"],"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-14T05:17:10.506Z"}