{"record":{"id":"dd19cd1ff0d1d5e5","repo":"pola-rs/polars","slug":"expected-an-argument","errorCode":null,"errorMessage":"expected an argument","messagePattern":"expected an argument","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-polars/pyo3-polars-derive/src/lib.rs","lineNumber":107,"sourceCode":"            // Set latest error, but leave return value in empty state.\n            pyo3_polars::derive::_update_last_error(err);\n        },\n    })\n}\n\nfn create_expression_function(ast: syn::ItemFn) -> proc_macro2::TokenStream {\n    // count how often the user define a kwargs argument.\n    let args = ast\n        .sig\n        .inputs\n        .iter()\n        .skip(1)\n        .map(|fn_arg| {\n            if let FnArg::Typed(pat) = fn_arg {\n                if let syn::Pat::Ident(pat) = pat.pat.as_ref() {\n                    pat.ident.to_string()\n                } else {\n                    panic!(\"expected an argument\")\n                }\n            } else {\n                panic!(\"expected a type argument\")\n            }\n        })\n        .collect::<Vec<_>>();\n\n    let fn_name = &ast.sig.ident;\n\n    // Get the tokenstream of the call logic.\n    let quote_call = match args.len() {\n        0 => quote_call_no_kwargs(&ast, fn_name),\n        1 => match args[0].as_str() {\n            \"kwargs\" => quote_call_kwargs(&ast, fn_name),\n            \"context\" => quote_call_context(&ast, fn_name),\n            a => panic!(\"didn't expect argument {a}\"),\n        },\n        2 => match (args[0].as_str(), args[1].as_str()) {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/pyo3-polars/pyo3-polars-derive/src/lib.rs#L89-L125","documentation":"Compile-time panic in the polars_expr proc macro (create_expression_function): a function argument in the decorated expression function is not a simple typed identifier pattern (syn::Pat::Ident), e.g. a tuple or destructuring pattern was used where a plain `name: Type` argument was expected.","triggerScenarios":"Thrown at pyo3-polars/pyo3-polars-derive/src/lib.rs:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the required argument to the attribute, e.g. `#[polars_expr(output_type=...)]` with its argument."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}