{"record":{"id":"1573e1c73dd6eab3","repo":"diesel-rs/diesel","slug":"expect-skip-zero-argument-variant","errorCode":null,"errorMessage":"expect `skip_zero_argument_variant`","messagePattern":"expect `skip_zero_argument_variant`","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"diesel_derives/src/sql_function.rs","lineNumber":1427,"sourceCode":"                        let count = input.parse::<LitInt>()?;\n                        if !input.is_empty(){\n                            return Err(syn::Error::new(input.span(), \"unexpected token after positional `#[variadic(..)]`\"));\n                        }\n                        Ok((count, LitBool::new(false, Span::call_site())))\n                    }\n                    else {\n                        let key: Ident = input.parse()?;\n                        if key != \"last_arguments\" {\n                            return Err(syn::Error::new(key.span(), \"expect `last_arguments`\"));\n                        }\n                        let _eq: Token![=] = input.parse()?;\n                        let count: LitInt = input.parse()?;\n                        let skip_zero: LitBool = if input.peek(Token![,]) {\n                            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                        ),","sourceCodeStart":1409,"sourceCodeEnd":1445,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/sql_function.rs#L1409-L1445","documentation":"This error comes from diesel's `#[sql_function]` proc macro when parsing the `#[variadic(last_arguments = N, skip_zero_argument_variant = ...)]` attribute. After `last_arguments = N`, an optional second key may be given, but the parser found an identifier other than `skip_zero_argument_variant`. The macro aborts compilation because the attribute syntax is not recognized.","triggerScenarios":"Using `#[sql_function]` with a `#[variadic(last_arguments = N, <wrong_key> = ...)]` attribute where the second key is misspelled or not `skip_zero_argument_variant` (e.g. `skip_zero`, `skip_zero_args`).","commonSituations":"Typos when copying the variadic attribute syntax from docs or other crates; renaming the option in custom code; mixing up diesel versions with different attribute spellings.","solutions":["Rename the second attribute key to exactly `skip_zero_argument_variant`","Remove the second key entirely, leaving only `#[variadic(last_arguments = N)]`","Check the diesel version's docs for the exact accepted variadic attribute syntax"],"exampleFix":"// before\n#[variadic(last_arguments = 2, skip_zero = true)]\n// after\n#[variadic(last_arguments = 2, skip_zero_argument_variant = true)]","handlingStrategy":"validation","validationCode":"fn check_variadic_attr(attr: &str) -> Result<(), String> {\n    let inner = attr.trim_start_matches(\"variadic(\").trim_end_matches(')');\n    let parts: Vec<&str> = inner.split(',').map(|s| s.trim()).collect();\n    if !parts[0].starts_with(\"last_arguments =\") { return Err(format!(\"bad key: {}\", parts[0])); }\n    if let Some(p) = parts.get(1) {\n        if !p.starts_with(\"skip_zero_argument_variant =\") {\n            return Err(format!(\"second key must be skip_zero_argument_variant, got: {}\", p));\n        }\n    }\n    Ok(())\n}","typeGuard":"fn is_valid_variadic_second_key(key: &str) -> bool { key == \"skip_zero_argument_variant\" }","tryCatchPattern":null,"preventionTips":["Copy the attribute syntax verbatim from diesel docs rather than retyping","Use the full option name `skip_zero_argument_variant`, never abbreviations","Pin your diesel version and check its docs for the exact variadic grammar"],"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"}