{"record":{"id":"0bcf3ff19794bf36","repo":"diesel-rs/diesel","slug":"expected-require-order-but-got-ident","errorCode":null,"errorMessage":"Expected `require_order` but got `{ident}`","messagePattern":"Expected `require_order` but got `(.+?)`","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"diesel_derives/src/sql_function.rs","lineNumber":1920,"sourceCode":"            SqlFunctionAttribute::Restriction {\n                restriction: BackendRestriction::None,\n                ..\n            } => {\n                unreachable!(\"We do not construct that\")\n            }\n            SqlFunctionAttribute::Other(attribute) => attribute.span(),\n        }\n    }\n}\n\nfn parse_require_order(input: &syn::parse::ParseBuffer<'_>) -> Result<bool> {\n    let ident = input.parse::<Ident>()?;\n    if ident == \"require_order\" {\n        let _ = input.parse::<Token![=]>()?;\n        let value = input.parse::<LitBool>()?;\n        Ok(value.value)\n    } else {\n        Err(syn::Error::new(\n            ident.span(),\n            format!(\"Expected `require_order` but got `{ident}`\"),\n        ))\n    }\n}\n\nimpl SqlFunctionAttribute {\n    fn parse_attr(\n        name: Ident,\n        input: &syn::parse::ParseBuffer<'_>,\n        attr: Attribute,\n        attribute_span: proc_macro2::Span,\n    ) -> Result<AttributeSpanWrapper<Self>> {\n        // rustc doesn't resolve cfg attrs for us :(\n        // This is hacky, but mostly for internal use\n        if name == \"cfg_attr\" {\n            let ident = input.parse::<Ident>()?;\n            if ident != \"feature\" {","sourceCodeStart":1902,"sourceCodeEnd":1938,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/sql_function.rs#L1902-L1938","documentation":"Inside `#[sql_function]`, the `parse_require_order` helper only accepts the key `require_order = <bool>`. Any other identifier passed where `require_order` is expected produces this error naming what was actually found.","triggerScenarios":"Calling the attr parser with an identifier other than `require_order` where the macro expects it — e.g. `require_ord = true`, `ordering = true`, or passing a key in the wrong position of the attribute list.","commonSituations":"Typos (`require_order` misspelled); assuming other ordering-related options exist; mixing option order so a value lands where a key is expected.","solutions":["Write the option exactly as `require_order = true` (or `= false`)","Fix any misspelling of `require_order`","Remove the extraneous token if it was not intended as an option"],"exampleFix":"// before\n#[sql_function(require_ord = true)]\n// after\n#[sql_function(require_order = true)]","handlingStrategy":"validation","validationCode":"fn is_require_order_key(key: &str) -> bool { key == \"require_order\" }","typeGuard":"fn is_require_order_key(key: &str) -> bool { key == \"require_order\" }","tryCatchPattern":null,"preventionTips":["Spell the option exactly `require_order` and always provide `= true` or `= false`","Provide a boolean literal, not an expression","Keep options in the documented order inside the attribute"],"tags":["proc-macro","rust","attribute-parsing","diesel"],"backgroundTag":"invalid-flag-value","analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}