{"record":{"id":"a64621f43193ef96","repo":"diesel-rs/diesel","slug":"e-the-correct-format-is-aggregate","errorCode":null,"errorMessage":"{e}, the correct format is `#[aggregate]`","messagePattern":"(.+?), the correct format is `#\\[aggregate\\]`","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"diesel_derives/src/sql_function.rs","lineNumber":1361,"sourceCode":"                    ..\n                }),\n            ..\n        }) if path.is_ident(\"sql_name\") => Ok(AttributeSpanWrapper {\n            attribute_span: attr.span(),\n            ident_span: sql_name.span(),\n            item: SqlFunctionAttribute::SqlName {\n                ident: path.require_ident()?.clone(),\n                value: sql_name.clone(),\n            },\n        }),\n        syn::Meta::Path(path) if path.is_ident(\"aggregate\") => Ok(AttributeSpanWrapper {\n            attribute_span: attr.span(),\n            ident_span: path.span(),\n            item: SqlFunctionAttribute::Aggregate {\n                ident: path\n                    .require_ident()\n                    .map_err(|e| {\n                        syn::Error::new(\n                            e.span(),\n                            format!(\"{e}, the correct format is `#[aggregate]`\"),\n                        )\n                    })?\n                    .clone(),\n            },\n        }),\n        syn::Meta::Path(path) if path.is_ident(\"skip_return_type_helper\") => {\n            Ok(AttributeSpanWrapper {\n                ident_span: attr.span(),\n                attribute_span: path.span(),\n                item: SqlFunctionAttribute::SkipReturnTypeHelper {\n                    ident: path\n                        .require_ident()\n                        .map_err(|e| {\n                            syn::Error::new(\n                                e.span(),\n                                format!(\"{e}, the correct format is `#[skip_return_type_helper]`\"),","sourceCodeStart":1343,"sourceCodeEnd":1379,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/sql_function.rs#L1343-L1379","documentation":"When parsing a `#[sql_function]` attribute list, the `#[aggregate]` attribute must be a bare path with a simple identifier. If `path.require_ident()` fails (e.g. the attribute path contains arguments, generics, or segments), the error is wrapped with the hint that the correct format is `#[aggregate]`.","triggerScenarios":"Writing `#[aggregate(...)]`, `#[aggregate = true]`, or a multi-segment path like `#[foo::aggregate]` where an identifier is expected, inside a `#[sql_function(...)]` attribute.","commonSituations":"Assuming `aggregate` takes a boolean or configuration value; copying serde-style attribute syntax into diesel attributes.","solutions":["Write the attribute as a bare `#[aggregate]` with no arguments or values.","Remove any `= value` assignment or parenthesized arguments after `aggregate`.","Check diesel documentation for configuration this attribute does (it does not accept parameters in this form)."],"exampleFix":"// before\n#[sql_function]\n#[aggregate = true]\nfn sum(x: Integer) -> Integer;\n\n// after\n#[sql_function]\n#[aggregate]\nfn sum(x: Integer) -> Integer;","handlingStrategy":"validation","validationCode":"// Attribute must be a bare path: #[aggregate]\nlet attr_src = \"#[aggregate]\";\nassert!(attr_src == \"#[aggregate]\"); // no args, no assignment","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat diesel sql_function attributes as bare flags unless docs show a parameter form.","Do not apply serde/clap-style key=value syntax to diesel attributes.","Consult the diesel docs page for #[sql_function] for the accepted attribute list."],"tags":["rust","proc-macro","diesel","attributes","sql-function"],"backgroundTag":"invalid-argument-format","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"}