{"record":{"id":"b3e6619f20dd3c3e","repo":"diesel-rs/diesel","slug":"e-the-correct-format-is-variadic-last-argume","errorCode":null,"errorMessage":"{e}, the correct format is `#[variadic(last_arguments = 3)]` or `#[variadic(last_arguments = 3, skip_zero_argument_variant = true)]`","messagePattern":"(.+?), the correct format is `#\\[variadic\\(last_arguments = 3\\)\\]` or `#\\[variadic\\(last_arguments = 3, skip_zero_argument_variant = true\\)\\]`","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"diesel_derives/src/sql_function.rs","lineNumber":1441,"sourceCode":"                            let _: Token![,] = input.parse()?;\n                            let key: Ident = input.parse()?;\n                            if key != \"skip_zero_argument_variant\" {\n                                return Err(\n                                    syn::Error::new(\n                                        key.span(), \"expect `skip_zero_argument_variant`\"\n                                    )\n                                );\n                            }\n                            let _eq: Token![=] = input.parse()?;\n                            input.parse()?\n                        } else {\n                            LitBool::new(false, Span::call_site())\n                        };\n                        Ok((count, skip_zero))\n                    }\n                })\n                .map_err(|e| {\n                    syn::Error::new(\n                        e.span(),\n                        format!(\n                            \"{e}, the correct format is `#[variadic(last_arguments = 3)]` or `#[variadic(last_arguments = 3, skip_zero_argument_variant = true)]`\"\n                        ),\n                    )\n                })?;\n            Ok(AttributeSpanWrapper {\n                item: SqlFunctionAttribute::Variadic {\n                    ident: path\n                        .require_ident()\n                        .map_err(|e| {\n                            syn::Error::new(\n                                e.span(),\n                                format!(\"{e}, the correct format is `#[variadic(3)]`\"),\n                            )\n                        })?\n                        .clone(),\n                    count: count.clone(),","sourceCodeStart":1423,"sourceCodeEnd":1459,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/sql_function.rs#L1423-L1459","documentation":"Wrapping error from the `#[sql_function]` macro: the inner parse of the `#[variadic(...)]` attribute failed, and diesel augments the inner message with the correct format hint `#[variadic(last_arguments = 3)]` or `#[variadic(last_arguments = 3, skip_zero_argument_variant = true)]`. It fires when the keyword-style variadic attribute does not match the expected `key = value` grammar.","triggerScenarios":"Calling `#[sql_function]` with a `#[variadic(last_arguments = ...)]` attribute whose inner tokens fail to parse (wrong key, missing `=`, missing integer literal, malformed boolean).","commonSituations":"Omitting the `=` sign, passing a non-integer for `last_arguments`, using strings instead of literals, or applying the attribute syntax from a different macro.","solutions":["Rewrite the attribute to exactly `#[variadic(last_arguments = N)]` or `#[variadic(last_arguments = N, skip_zero_argument_variant = true)]`","Ensure `last_arguments` is a bare integer literal and `skip_zero_argument_variant` is `true`/`false`","Read the inner `{e}` message in the compiler output — it pinpoints which token was wrong"],"exampleFix":"// before\n#[variadic(last_arguments: 2)]\n// after\n#[variadic(last_arguments = 2)]","handlingStrategy":"validation","validationCode":"fn validate_variadic_kw(inner: &str) -> Result<(), String> {\n    let ok = inner.trim().starts_with(\"last_arguments =\")\n        && inner.split(',').map(str::trim).skip(1).all(|p| p.starts_with(\"skip_zero_argument_variant =\"));\n    if ok { Ok(()) } else { Err(format!(\"use #[variadic(last_arguments = 3)] or #[variadic(last_arguments = 3, skip_zero_argument_variant = true)]: got {}\", inner)) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use `key = value` syntax with bare integer literals inside variadic()","Don't mix positional and keyword variadic syntax","Read the inner message appended before the format hint — it names the offending token"],"tags":["proc-macro","rust","attribute-parsing","diesel"],"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"}